0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PostgreSQLでテーブルを作成する

Posted at

PostgreSQLの勉強を始めたため、備忘録として書いています。
筆者は初学者なので、間違いや不備などがございましたらご容赦ください。

基本構文

DROP TABLE IF EXISTS table_name;
CREATE TABLE table_name (columns_name VARCHAR(255));

複数のカラムを持つテーブル作成

DROP TABLE IF EXISTS table_some_columns;
CREATE TABLE table_some_columns (
    user_id VARCHAR(50) PRIMARY KEY
    , user_name VARCHAR(30) NOT NULL
    , user_age INT
    , birth_day DATE
    , height NUMERIC
    , weight NUMERIC
    , date_create TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);

参考サイト

PostgreSQL 10.5文書-第8章 データ型

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?