Mega Code Archive

 
Categories / PostgreSQL / Constraints
 

Add PRIMARY KEY in table creation

postgres=# postgres=# CREATE TABLE new_books postgres-#               (id integer CONSTRAINT books_id_pkey PRIMARY KEY, postgres(#               title text NOT NULL, postgres(#               author_id integer, postgres(#               subject_id integer); NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "books_id_pkey" for table "new_books" CREATE TABLE postgres=# postgres=# drop table new_books; DROP TABLE postgres=#