You are on page 1of 1

Q.

1
b) create table quest5class(class_name varchar2(30),description varchar2(100),
constraint quest5class_class_name_pk primary key(class_name));
a) create table quest5student(stud_no number(4),stud_name varchar2(30),class_name
varchar2(30),
constraint quest5student_stud_no_pk primary key(stud_no),
constraint quest5student_class_name_fk foreign key(class_name) references
quest5class(class_name));
c) create table quest5lab(mach_no number(4),lab_no number(4),description
varchar2(100),
constraint quest5lab_mach_no_pk primary key(mach_no));
d) create table quest5allot(stud_no number(4),mach_no number(4),dayofweek
varchar2(100),
constraint quest5allot_stud_no_fk foreign key(stud_no) references
quest5student(stud_no),
constraint quest5allot_mach_no foreign key(mach_no) references
quest5lab(mach_no));
Q.2
a) insert into quest5class values('&class_name','&description')
b) insert into quest5student values(&stud_no,'&stud_name','&class_name')
c) insert into quest5lab values(&mach_no,&lab_no,'&description')
d) insert into quest5allot values(&stud_no,&mach_no,'&dayofweek')
Q.3 select
s.stud_no,s.stud_name,s.class_name,c.description,l.mach_no,l.lab_no,l.description,a
.dayofweek from
quest5student s,quest5lab l,quest5allot a,quest5class c where
a.stud_no=s.stud_no and a.mach_no=l.mach_no and s.class_name=c.class_name
Q.4 select a.dayofweek,count(*) "Lab Allotment" from quest5allot a,quest5lab l
where a.mach_no=l.mach_no group by a.dayofweek order by a.dayofweek asc
Q.5 select c.class_name,count(*) "Machines Alloted" from quest5student s,quest5lab
l,quest5allot a,quest5class c where
c.class_name='bca' and a.mach_no=l.mach_no and a.stud_no=s.stud_no and
s.class_name=c.class_name group by c.class_name
Q.6 select
s.stud_no,s.stud_name,s.class_name,l.mach_no,l.lab_no,l.description,a.dayofweek
from quest5student s,quest5lab l,quest5allot a,quest5class c
where s.stud_no=5 and a.stud_no=s.stud_no and s.class_name=c.class_name and
a.mach_no=l.mach_no
Q.7 select a.dayofweek,l.lab_no,count(*) "Machine Allocated" from quest5student
s,quest5lab l,quest5allot a
where (l.lab_no=1 and a.dayofweek='monday') and a.mach_no=l.mach_no and
a.stud_no=s.stud_no group by a.dayofweek,l.lab_no
Q.8 select c.class_name,count(*) "Students Alloted Machines" from quest5student
s,quest5lab l,quest5allot a,quest5class c
where a.stud_no=s.stud_no and a.mach_no=l.mach_no and s.class_name=c.class_name
group by c.class_name
Q.9 create view quest5view1 as select
s.stud_no,s.stud_name,l.mach_no,l.lab_no,a.dayofweek from quest5student s,quest5lab
l,quest5allot a,quest5class c
where a.stud_no=s.stud_no and a.mach_no=l.mach_no and s.class_name=c.class_name
Q.10 create view quest5view2 as select
l.mach_no,l.lab_no,l.description,s.stud_no,s.stud_name,c.class_name from
quest5student s,quest5class c,quest5lab l,quest5allot a
where a.dayofweek='thursday' and a.stud_no=s.stud_no and a.mach_no=l.mach_no
and s.class_name=c.class_name

You might also like