SQL Primary Key is used to uniquely identify each
row in our table An SQL Primary Key can consist of one or more fields on a
table. When multiple fields are used as an SQL primary key,
they are called a composite SQL primary key. Primary keys can be specified either when the table
is created (using SQL CREATE TABLE) or by changing the
existing table structure (using SQL ALTER TABLE). A primary key column cannot contain NULL values.
CREATE TABLE Persons
(
P_Id int NOT NULL PRIMARY KEY,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
CREATE TABLE Persons
(
P_Id int NOT NULL PRIMARY KEY,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
0 comments:
Post a Comment