SQL Primary Key

primary key of a table in database uniquely identifies each record in the table.
Primary Key may consist of a single attribute or multiple attributes in combination.
A Primary key column canot cantain null values.
Each table should have primary key.
And each table can have only one primary key.


SYNTAX :
CREATE TABLE Employee
(
E_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (E_Id)
)



Mysql/SQl Server/Oracle/MS Access:

CREATE TABLE Employee
(
E_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
CONSTRAINT ak_EmployeeID PRIMARY KEY (E_Id,LastName)
)




Online Execute/Compile

Quantitative Aptitude
Reasoning
Programming
Interview