PostgreSQL/Constraints/Add Primary Key
Add primary key in table create statement
postgres=#
postgres=#
postgres=# CREATE TABLE "states" (
postgres(# "id" integer NOT NULL,
postgres(# "name" text,
postgres(# "abbreviation" character(2),
postgres(# Constraint "state_pkey" Primary Key ("id")
postgres(# );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "state_pkey" for table "states"
CREATE TABLE
postgres=#
postgres=# drop table states;
DROP TABLE
postgres=#