PostgreSQL/Constraints/Add Primary Key

Материал из SQL эксперт
Версия от 13:14, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Add primary key in table create statement

   <source lang="sql">

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=#

      </source>