Primary Key Constraint: ======================= => Primary key constraint is the combination of unique constraint and not null constraint. => All other constraints like unique, not null and check etc are allowed to define on multiple fields/columns of the same table. But the primary key constraint can allow to define only once in a table. => we can able to use the primary key constraint at column level and also at table level. create table dummy ( sno number(10) unique, id int unique, name varchar2(50) not null, age int(2) check (age >= 18 and age <= 60), gender varchar2(15) not null, location varchar(30) not null ); Column level primary key constraint: ------------------------------------ Syntax: create table table-name ( col1 datatype primary key, col2 datatype, .... ); create table products102 ( sno number(10) unique, product_id int primary key, product_name varchar2(50) not null, price decimal(10,2) check(price >= 1) ); insert into products102 values(1,112233,'Laptop',59999); insert into products102 values(2,113233,'Smart Phone',29999); insert into products102 values(3,102030,'Speakers',69999); select * from products102; Table level primary key constraint: ----------------------------------- Syntax: ------ create table table-name ( col1 datatype, col2 datatype, constraint primary key(column-name) ); Ex: create table employee121 ( sno number(10) unique not null, emp_id int, emp_name varchar2(50) not null, salary decimal(10,2) check(salary > 0), location varchar2(30) not null, constraint pk_const primary key(emp_id) ); Defining of the primary key constraint for the existing table: --------------------------------------------------------------- => we can use the alter command Syntax: alter table table-name add constraint primary key(column-name); Enabling/Disabling of primary key constraint: --------------------------------------------- Syntax: alter table table-name enable primary key; alter table table-name disable primary key; Q: Write a query to display all constraints? ============================================ Syntax: select * from user_constraints; Q: Write a query to display all constraints of the given/particular table? ========================================================================== Syntax: select * from user_constraints where table_name = 'products102'; ====================================================