Microsoft Access Database Development With VBA

SQL Keywords: PRIMARY

   

Description

The PRIMARY keyword is used with the KEY keyword to create a primary key on a column. Here is an example:

CREATE TABLE Genders(GenderID COUNTER(1,1) PRIMARY KEY NOT NULL,
                     Gender varchar(20));

Here is an example that uses the CONSTRAINT keyword:

CREATE TABLE Persons(PersonID COUNTER(1,1) NOT NULL,
                     FirstName varchar(20),
                     LastName varchar(20) NOT NULL,
                     CONSTRAINT PK_People PRIMARY KEY(PersonID));
     
 

Home Copyright © 2012-2013 FunctionX, Inc. Home