in Oracle by
Q:
Q. What are the constraints? How to add a named PRIMARY KEY constraint in SQL?

► Click here to show 1 Answer

0 votes
by

Ans is

This is the most common Oracle Interview Questions asked in an interview. Constraints are the rules defined over data. Named constraint for a primary key can be added in two ways:
1. During table creation:
CREATE TABLE Employees (
Eid int NOT NULL,
Name varchar(255) NOT NULL,
Salary number(8),
Age int,
CONSTRAINT PK_ID PRIMARY KEY (Eid)
);

2. In the Alter statement
ALTER TABLE Employees
ADD CONSTRAINT PK_ID PRIMARY KEY (Eid);

Learn More with Madanswer

Related questions

0 votes
0 votes
asked May 11, 2020 in Oracle by JackTerrance
0 votes
asked Jul 29, 2020 in Oracle by Hodge
...