RSS Feed

PRIMARY KEY Constraint

SQL PRIMARY KEY Constraint

SQL PRIMARY KEY Constraint - same as UNIQUE Constraint except that Primary Key constraints does not allow null values (whether or not the column definition specifies NOT NULL) and only one primary key constraint can be defined for each table.

Example of SQL PRIMARY KEY Constraint

CREATE TABLE Sells (
  bar   CHAR(20),
  beer  VARCHAR(20) DEFAULT 'Kingfisher',
  price REAL  NOT NULL,
  PRIMARY KEY (bar,beer)
 );


Also See:
Difference between Unique & Primary key.

No comments:

Post a Comment