PostgreSQL/Constraints/Add Primary Key — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 13:14, 26 мая 2010

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>