Adding a Primary Key Index with SQL DDL

By using SQL DDL statements, you can specify a CONSTRAINT clause to create a primary key index at the time the table is created:

CREATE TABLE Parking_Tickets
	(Ticket_ID INTEGER CONSTRAINT PrimaryKey PRIMARY KEY,
	Violator_Name TEXT (30),
	Violation_Type TEXT (10));

This DDL statement creates a primary key index for the Ticket_ID field and gives it the name “PrimaryKey.” Although the primary key index can be given any name, PrimaryKey is a good choice because that’s the name Microsoft Access assigns by default when you create a primary key for a table in Design view.