Extension of SimpleDB, a lightweight SQL RDBMS that supports indexes, multi-tenancy, and transactions. Implemented as part of CS3223 Database Implementation project.
java --version # Java RE version should output >11
Eclipse is the recommended code editor.
For VS Code, the following VSC extensions are recommended (VSC will prompt to install these extentions on launch):
studentdb
directory is created. Otherwise, run test/CreateStudentDB
script.test/SimpleIJ
script.NOTE: Should you run into issues, delete the
studentdb
directory and repeat from step 1
Implementation is an extension of SimpleDB from Edward Sciore. Project is used solely for educational purpose.
Done in the CreateStudentDB2.java file
select sid, sname from student
select sid, sname from student where sid = 5
select sid, sname from student where sname > 'bob'
select sid, majorid from student where sid = 10
select sid, majorid from student where majorid = 20
select cid, title, deptid from course order by cid
select gradyear, sname, sid from student order by gradyear desc, sid desc
select yearoffered from section group by yearoffered
select yearoffered, courseid from section group by yearoffered, courseid
select avg(eid) from enroll
select avg(eid), min(studentid), sum(sectionid) from enroll
select studentid, count(eid) from enroll group by studentid
select prof, courseid, min(yearoffered), max(yearoffered) from section group by prof, courseid
select distinct yearoffered from section
select distinct majorid, gradyear from student
select gradyear, count(sid) from student where gradyear > 2020 and sname > 'bob' group by gradyear order by countofsid
select sid,studentid,grade from student,enroll where sid>studentid
select sid,studentid,sname, grade from enroll, student where sid=studentid
select sid,majorid,did from dept,student where majorid=did
Hash/Sort-merge/Nested-loop Join:
select sid,sname,dname,title,grade from student,dept,course,enroll where sid=studentid and deptid=did and majorid=did
Idx Join:
select sid,sname,did,title,grade from dept,course,enroll,student where sid=studentid and majorid=did and deptid=did
Following Postgres, there are 2 cases for ORDER BY:
If there is GROUP BY or DISTINCT then the sort fields must be found in the GROUP BY or DISTINCT field.
select distinct sname from student order by sname
select sname from student group by sname order by sname
select distinct sname from student order by sid
select sname from student group by sname order by sid
If there is no GROUP BY or DISTINCT then can sort on any field in the tables (beyond what is being projected).
select sname from student order by sid