Table "test.sample"に、主キー制約

testdb=# \d test.sample
                     Table "test.sample"
  Column   |  Type   | Collation | Nullable |    Default     
-----------+---------+-----------+----------+----------------
 id        | integer |           |          | 
 name      | text    |           |          | 
 address   | text    |           |          | 
 groupname | text    |           |          | '営業部'::text
 memo      | text    |           |          | 
Indexes:
    "sample_name_key" UNIQUE CONSTRAINT, btree (name)
testdb=# ALTER TABLE sample ADD PRIMARY KEY(id);
ALTER TABLE
testdb=# \d sample
                     Table "test.sample"
  Column   |  Type   | Collation | Nullable |    Default     
-----------+---------+-----------+----------+----------------
 id        | integer |           | not null | 
 name      | text    |           |          | 
 address   | text    |           |          | 
 groupname | text    |           |          | '営業部'::text
 memo      | text    |           |          | 
Indexes:
    "sample_pkey" PRIMARY KEY, btree (id)
    "sample_name_key" UNIQUE CONSTRAINT, btree (name)

いいなと思ったら応援しよう!