What is Primary Key in SQL - Web Development
57 Views

What is Primary Key in SQL

What is a Primary Key?


The PRIMARY KEY constraint uniquely identifies each row in a table. It must contain UNIQUE values and has an implicit NOT NULL constraint.
A table in SQL is strictly restricted to have one and only one primary key, which is comprised of single or multiple fields (columns).

The PRIMARY KEY imperative interestingly recognizes each column in a table. It must contain UNIQUE qualities and has a certain NOT NULL limitation.

A table in SQL is carefully limited to have one and just a single essential key, which is involved single or various fields (segments).

CREATE TABLE Employee(
Emp_ID INT NOT NULL
First_Name VARCHAR(25)
PRIMARY KEY ( Emp_ID )
);

CREATE TABLE Employee (
Emp_ID INT NOT NULL
F_Name VARCHAR(255)
Father_Name VARCHAR(55) NOT NULL,
CONSTRAINT PK_employee
PRIMARY KEY ( Emp_ID , F_Name)
);

ALTER TABLE employee
ADD PRIMARY KEY (emp_ID);

ALTER TABLE Employee;

Leave a Reply

Your email address will not be published. Required fields are marked *