Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Submitted by:
Submitted to:
Mr. Abhishek jain.
LAB ASSIGNMENT-5
1. Create table emp which has the following
attributes (employee
table)
(@empno, ename, job, sal, deptno)
Where empno is primary key, ename is
unique, job in (Prof, AP,
and Lect), sal is not NULL, and deptno default
is 10.
Insert appropriate records, check error
messages in case of
violation and list all the constraint names for
given table.
ans: create table employee27
(
enamevarchar(20)constraint uniquec1
unique,
empnonumber(6)constraint primaryc1
primary key,
job varchar(25) check(job
in('prof','Assistprof','lect')),sal
number(10)constraint notc1 not null,deptno
number(10)default 10
);
query used:
select * from user_constraints where
table_name ='BOOK27';
3. Create table st
Rno-Number
Class-Char
Marks-Number
Primary key(rno,class)
Marks>0
Insert appropriate records, check error
messages in case of
violation and list all the constraint names for
given table.
ans:
create table st_3
(rnonumber(10),class varchar(6),marks
number(6),constraint primaryc3 primary
key(roll_no,class),check(marks>0));
query used:
select * from user_constraints where
table_name ='ST_3';