DBMS - Assignment/Answer/course - Stu - Regis - Assign
DBMS - Assignment/Answer/course - Stu - Regis - Assign
DBMS - Assignment/Answer/course - Stu - Regis - Assign
create table COURSE (CourseID number(4) primary key, CourseName varchar2(20), Duration number(1),
Fees number(7,2));
STUDENT
create table student (StudId number(4) Primary key, FirstName varchar2(10), LastName varchar2(10),
Street Varchar2(15), City Varchar2(15), DOB date);
REGISTRATION
4. select coursename, fees-500 "new fees" from course where duration <=3;
5. delete from student where lastname='David' and city='Chennai'; (note this query will lead to error
since this table is being referred by another table called registration).
10. select * from student where EXTRACT(Month FROM dob) between 04 and 09;
(Or) select * from student where to_char(dob, 'mm') between 04 and 09;
18. select * from student where DOB =(select min(DOB) from student);
19. select * from student where StudId != 3004 and StudId != 3006; (Or)
2. select * from student where dob < (select dob from student where firstname='Bala' and
lastname='Krishnan');
3. select sum(c.fees) sum from student s, course c, registration r where s.studid=r.studid and
r.courseid=c.courseid and s.city='Bangalore';
4. select s.firstname, c.coursename from student s, course c, registration r where s.studid=r.studid and
r.courseid=c.courseid order by coursename;
5. select c.* from course c, course e where e.fees=c.fees and e.courseid != c.courseid;
7. select max(fees) from course where fees <(select max(fees) from course);
8. select r.studid, sum(c.fees) as total_fees from course c, registration r where r.courseid = c.courseid
group by (r.studid) order by r.studid;
9. select r.courseid, c.coursename, sum(c.fees) total_fees from course c, registration r where c.courseid=
r.courseid group by r.courseid, c.coursename order by r.courseid;