don-tay / simpledb

Subset of SQL-compliant DBMS
0 stars 0 forks source link

Query bank #52

Open don-tay opened 2 years ago

don-tay commented 2 years ago

List of queries to test on:

select sid,sname from student order by sname
select sid,sname from student order by sname desc
select SId, Sname, GradYear from student order by GradYear asc, Sname desc

3 table join query:

select sid,sname,dname,grade from student,dept,enroll where sid=studentid and majorid=did
select sid,sname,eid,sectid from student, enroll, section where sid=studentid and sectionid=sectid

3 table join with distinct/group by:

select distinct did, title, prof from dept, course, section where did=deptid and cid=courseid order by prof
select distinct sid,sname,dname,title,grade from student,dept,course,enroll where sid=studentid and deptid=did and majorid=did and sectionid = sectid

4 table join query:

select sid,sname,dname,title,grade from student,dept,course,enroll where sid=studentid and deptid=did and majorid=did

Error queries:

select dname,count(sid) from student, dept where majorid=did group by dname order by dname desc