Download presentation
Presentation is loading. Please wait.
1
The Student Database Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301 GradStudent sidnameaddrageGPA 501Raymond180 Westwood233.9 502Amy301 Wilshire353.4 503Jack220 Gayley223.5 504Dan220 Gayley253.3
2
The Selection Operator Give me information of students under the age of 18 age<18 (Student) sidnameaddrageGPA 303Elaine301 Wilshire173.9 401James183 Westwood173.6 sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1
3
The Projection Operator Give me the name, address, and GPA of all the students name, addr, GPA (Student) name, GPA, addr (Student) sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 nameaddrGPA John183 Westwood2.1 Elaine301 Wilshire3.9 James183 Westwood3.6 Esther421 Gayley3.1 nameGPAaddr John2.1183 Westwood Elaine3.9301 Wilshire James3.6183 Westwood Esther3.1421 Gayley
4
Sample Query Give me the SID and GPA for students under the age of 18 sid, GPA ( age<18 (Student)) sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 sidnameaddrageGPA 303Elaine301 Wilshire173.9 401James183 Westwood173.6 sidGPA 3033.9 4013.6
5
The Cross Product Operator Give me all combinations of students and the enrollment of students Student Enroll = (Student.sid, name, addr, age, GPA, Enroll.sid, dept, cnum, sec) Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 303Elaine301 Wilshire173.9301CS14301 303Elaine301 Wilshire173.9301EE30101 303Elaine301 Wilshire173.9303CS11201 303Elaine301 Wilshire173.9401EE18301 401James183 Westwood173.6301CS14301 401James183 Westwood173.6301EE30101 401James183 Westwood173.6303CS11201 401James183 Westwood173.6401EE18301 208Esther421 Gayley203.1301CS14301 208Esther421 Gayley203.1301EE30101 208Esther421 Gayley203.1303CS11201 208Esther421 Gayley203.1401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 303Elaine301 Wilshire173.9301CS14301 303Elaine301 Wilshire173.9301EE30101 303Elaine301 Wilshire173.9303CS11201 303Elaine301 Wilshire173.9401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 303Elaine301 Wilshire173.9301CS14301 303Elaine301 Wilshire173.9301EE30101 303Elaine301 Wilshire173.9303CS11201 303Elaine301 Wilshire173.9401EE18301 401James183 Westwood173.6301CS14301 401James183 Westwood173.6301EE30101 401James183 Westwood173.6303CS11201 401James183 Westwood173.6401EE18301 Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301
6
Selecting on Cross Products Give me all the information of enrolled students Student.sid = Enroll.sid (Student Enroll) Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 303Elaine301 Wilshire173.9303CS11201 401James183 Westwood173.6401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 303Elaine301 Wilshire173.9301CS14301 303Elaine301 Wilshire173.9301EE30101 303Elaine301 Wilshire173.9303CS11201 303Elaine301 Wilshire173.9401EE18301 401James183 Westwood173.6301CS14301 401James183 Westwood173.6301EE30101 401James183 Westwood173.6303CS11201 401James183 Westwood173.6401EE18301 208Esther421 Gayley203.1301CS14301 208Esther421 Gayley203.1301EE30101 208Esther421 Gayley203.1303CS11201 208Esther421 Gayley203.1401EE18301 Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301
7
Sample Query Give me the name and addresses of students taking CS courses whose GPA is below 3.0 name, addr ( dept = ‘CS’ GPA < 3.0 Student.sid = Enroll.sid (Student Enroll)) Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 301John183 Westwood192.1303CS11201 301John183 Westwood192.1401EE18301 303Elaine301 Wilshire173.9301CS14301 303Elaine301 Wilshire173.9301EE30101 303Elaine301 Wilshire173.9303CS11201 303Elaine301 Wilshire173.9401EE18301 401James183 Westwood173.6301CS14301 401James183 Westwood173.6301EE30101 401James183 Westwood173.6303CS11201 401James183 Westwood173.6401EE18301 208Esther421 Gayley203.1301CS14301 208Esther421 Gayley203.1301EE30101 208Esther421 Gayley203.1303CS11201 208Esther421 Gayley203.1401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 303Elaine301 Wilshire173.9303CS11201 401James183 Westwood173.6401EE18301 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 301John183 Westwood192.1301EE30101 Student.sidnameaddrageGPAEnroll.siddeptcnumsec 301John183 Westwood192.1301CS14301 nameaddr John183 Westwood Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301
8
The Join Operator ClassEnroll Class.dept = Enroll.dept Class.cnum = Enroll.cnum Class.sec = Enroll.sec (Class Enroll) Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301 Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz C.deptC.cnumC.sectitleinstructorsidE.deptElcnumE.sec CS14301DB SystemsJohn Cho301CS14301 CS14301DB SystemsJohn Cho301EE30101 CS14301DB SystemsJohn Cho303CS11201 CS14301DB SystemsJohn Cho401EE18301 CS11201ModelingDick Muntz301CS14301 CS11201ModelingDick Muntz301EE30101 CS11201ModelingDick Muntz303CS11201 CS11201ModelingDick Muntz401EE18301 EE30101SignalJames Dean301CS14301 EE30101SignalJames Dean301EE30101 EE30101SignalJames Dean303CS11201 EE30101SignalJames Dean401EE18301 EE18301MechanicsDick Muntz301CS14301 EE18301MechanicsDick Muntz301EE30101 EE18301MechanicsDick Muntz303CS11201 EE18301MechanicsDick Muntz401EE18301 C.deptC.cnumC.sectitleinstructorsidE.deptE.cnumE.sec CS14301DB SystemsJohn Cho301CS14301 CS11201ModelingDick Muntz303CS11201 EE30101SignalJames Dean301EE30101 EE18301MechanicsDick Muntz401EE18301
9
The Theta-Join Operator Class Class.cnum = Enroll.cnum Enroll.dept = ‘CS’ Enroll Class.cnum = Enroll.cnum Enroll.dept = ‘CS’ (Student Enroll) Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301 Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz C.deptC.cnumC.sectitleinstructorsidE.deptE.cnumE.sec CS14301DB SystemsJohn Cho301CS14301 CS14301DB SystemsJohn Cho301EE30101 CS14301DB SystemsJohn Cho303CS11201 CS14301DB SystemsJohn Cho401EE18301 CS11201ModelingDick Muntz301CS14301 CS11201ModelingDick Muntz301EE30101 CS11201ModelingDick Muntz303CS11201 CS11201ModelingDick Muntz401EE18301 EE30101SignalJames Dean301CS14301 EE30101SignalJames Dean301EE30101 EE30101SignalJames Dean303CS11201 EE30101SignalJames Dean401EE18301 EE18301MechanicsDick Muntz301CS14301 EE18301MechanicsDick Muntz301EE30101 EE18301MechanicsDick Muntz303CS11201 EE18301MechanicsDick Muntz401EE18301 C.deptC.cnumC.sectitleinstructorsidE.deptE.cnumE.sec CS14301DB SystemsJohn Cho301CS14301 CS11201ModelingDick Muntz303CS11201
10
The Union Operator Give me the SIDs of all students sid (Student GradStudent) Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 GradStudent sidnameaddrageGPA 501Raymond180 Westwood233.9 502Amy301 Wilshire353.4 503Jack220 Gayley223.5 504Dan220 Gayley253.3 sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 501Raymond180 Westwood233.9 502Amy301 Wilshire353.4 503Jack220 Gayley223.5 504Dan220 Gayley253.3 sid 301 303 401 208 501 502 503 504
11
The Set-Difference Operator – Give me the department, course number, and section of all classes without any enrolled students dept, cnum, sec (Class) – dept, cnum, sec (Enroll) Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301 deptcnumsec CS14301 CS11201 EE30101 EE18301 deptcnumsec CS14301 EE30101 CS11201 EE18301 deptcnumsec
12
The Set-Intersection Operator Give all the instructors who teaches both CS and EE classes instructor ( dept=’CS’ (Class)) instructor ( dept=’EE’ (Class)) Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz instructor John Cho Dick Muntz instructor James Dean Dick Muntz instructor Dick Muntz
13
The Rename Operator Give me pairs of student names who live at the same address R.name > S.name ( name, name ( R.addr = S.addr ( R (Student) S (Student) ) ) ) Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 R.sidR.nameR.AddrR.AgeR.GPAS.SidS.NameS.AddrS.AgeS.GPA 301John183 Westwood192.1301John183 Westwood192.1 301John183 Westwood192.1303Elaine301 Wilshire173.9 301John183 Westwood192.1401James183 Westwood173.6 301John183 Westwood192.1208Esther421 Gayley203.1 303Elaine301 Wilshire173.9301John183 Westwood192.1 303Elaine301 Wilshire173.9303Elaine301 Wilshire173.9 303Elaine301 Wilshire173.9401James183 Westwood173.6 303Elaine301 Wilshire173.9208Esther421 Gayley203.1 401James183 Westwood173.6301John183 Westwood192.1 401James183 Westwood173.6303Elaine301 Wilshire173.9 401James183 Westwood173.6401James183 Westwood173.6 401James183 Westwood173.6208Esther421 Gayley203.1 208Esther421 Gayley203.1301John183 Westwood192.1 208Esther421 Gayley203.1303Elaine301 Wilshire173.9 208Esther421 Gayley203.1401James183 Westwood173.6 208Esther421 Gayley203.1208Esther421 Gayley203.1 R.sidR.nameR.AddrR.AgeR.GPAS.SidS.NameS.AddrS.AgeS.GPA 301John183 Westwood192.1301John183 Westwood192.1 301John183 Westwood192.1401James183 Westwood173.6 303Elaine301 Wilshire173.9303Elaine301 Wilshire173.9 401James183 Westwood173.6301John183 Westwood192.1 401James183 Westwood173.6401James183 Westwood173.6 208Esther421 Gayley203.1208Esther421 Gayley203.1 R.nameS.Name John James Elaine JamesJohn James Esther R.nameS.Name JamesJohn
14
The Division Operator / Give me the SIDs of students who are enrolled in all of the CS classes sid (Student) – sid ( sid (Student dept, cnum, sec ( dept=’CS’ (Class))) – Enroll) Student sidnameaddrageGPA 301John183 Westwood192.1 303Elaine301 Wilshire173.9 401James183 Westwood173.6 208Esther421 Gayley203.1 Class deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz Enroll siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301
15
The Division Operator / Give me the SIDs of students who are enrolled in all of the CS classes sid (Student) – sid ( sid (Student) dept, cnum, sec ( dept=’CS’ (Class) ) – Enroll) ) deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz EE30101SignalJames Dean EE18301MechanicsDick Muntz deptcnumsectitleinstructor CS14301DB SystemsJohn Cho CS11201ModelingDick Muntz siddeptcnumsec 301CS14301 301CS11201 303CS14301 303CS11201 401CS14301 401CS11201 208CS14301 208CS11201 deptcnumsec CS14301 CS11201 sid 301 303 401 208 siddeptcnumsec 301CS14301 301EE30101 303CS11201 401EE18301 siddeptcnumsec 303CS14301 401CS14301 401CS11201 208CS14301 208CS11201 sid 301 303 401 208 sid 301 sid 303 401 208
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.