5.3. PRIMARY KEY
- The PRIMARY KEY constraint uniquely identifies each record in a table.
- Primary keys must contain UNIQUE values, and cannot contain NULL values.
- A table can have only one primary key, which may consist of single or multiple fields.
QUERY: - CREATE TABLE employee (e_id int PRIMARY KEY);
- SQL PRIMARY KEY on ALTER TABLE :-
QUERY: - ALTER TABLE Table_Name ADD primary key (column)
EXAMPLE: - ALTER TABLE employee ADD PRIMARY KEY(e_id);
Last modified: Monday, 2 December 2019, 12:17 PM