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

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);

Related questions

0 votes
0 votes
+1 vote
asked Jul 29, 2020 in Oracle by Hodge
0 votes
asked Jul 29, 2020 in Oracle by Hodge
0 votes
asked Jul 29, 2020 in Oracle by Hodge
...