Tutorial - 6 ID: 190030562 Name: G Likhith Chowdary University Online Examination Scheduling System)
Tutorial - 6 ID: 190030562 Name: G Likhith Chowdary University Online Examination Scheduling System)
ID: 190030562
Implement the following SQL Queries on Case study 2 ( University Online Examination
Scheduling system)
1) Create all the necessary tables with all the required constraints
Solution:
use online_university_exams_190030562;
Name VARCHAR(100),
Address VARCHAR(100),
emgPN INT,
);
Name VARCHAR(100),
Coursecode VARCHAR(100),
dept VARCHAR(50),
);
);
primary key(sno),
);
emgPN int,
primary key(FID)
);
);
);
);
2) Insert appropriate data into the tables
Solution:
values(2,'','vjy',123456,111213),
(3,'ajay','vjy',15689944,264445);
values ('ece',2),('ece',3);
value(1,'tharun','vjy',123456,111213);
values('cse',1);
value('dbms','19sc1230','cse'),
('os','19cs1200','cse'),
('qp','19sc166','ece');
value(1,1),
(1,2);
values(3012,'raj','vjy',13456,1113),
(3013,'kavin','vjy',15515,111254);
value(102,24,1);
(3013,'sqaud');
values(1,'regular','2020-09-08',3012),
(1,'supply','2020-09-08',3012),
(1,'detained','2020-09-08',3012),
(1,'regular','2020-09-08',3013),
(1,'supply','2020-09-08',3013),
(1,'detained','2020-09-08',3013),
(2,'regular','2020-09-09',3013);
3) Display the number of students enrolled for exam ‘DBMS’
Solution: select count(*) as no_stud_dbms from creg where cid=(select cid from course where
name='dbms');
8) Update the exam date of ‘OS’ which is postponed to 2 days after the scheduled date
Solution: update examt set dte='2020-09-11' where cid=1;(previous date is 2020-09-09)
9) Give the no. of students enrolled in each course department-wise
Solution: select dept,count(*) as no_reg from cregd group by dept ;
10) Display the course details where the enrolled students are greater than the enrolled students in
DBMS
Solution:
select dept,count(*) as no_reg from cregd group by dept having count(*)>(select count(*) from
cregd where dept='cse');