DATA 225 Database Systems for Analytics (Instructor: Ron Mak)
Introduction to SQL Queries  
Database tables
student
id last first contact_id
S1001 Doe John C03
S1005 Nova Tim C04
S1009 Klein Leslie C05
S1014 Jane Mary C01
S1021 Smith Kim C02
teacher
id last first contact_id
T7003 Rogers Pat C06
T7008 Thompson Sidney C07
T7012 Lane John C08
T7051 Flynn Mabel C09
contact
id email
C01 mary.jane@state.edu
C02 kim.smith@state.edu
C03 john.doe@state.edu
C04 tim.novak@state.edu
C05 leslie.klein@state.edu
C06 pat.rogers@state.edu
C07 sidneythompson@state.edu
C08 john.lane@state.edu
C09 mabel.flynn@state.edu
class
code subject room teacher_id
DATA 200 Python Programming 101 T7051
DATA 220 Mathematical Models 114 T7008
DATA 225 Database Systems 101 T7003
DATA 240 Data Mining 120 T7012
DATA 245 Machine Learning 115 T7051
takes
student_id class_code
S1014 DATA 200
S1021 DATA 200
S1001 DATA 220
S1005 DATA 220
S1001 DATA 225
S1005 DATA 225
S1021 DATA 225
S1001 DATA 240
S1021 DATA 240
S1005 DATA 245
S1014 DATA 245
Queries
Who are the students?
Who are the teachers?
What are the classes?
What is the email address of student ?
What is the email address of teacher ?
Which student has email address ?
Which teacher has email address ?
What is the class code of ?
Which students meet in room ?
Who teaches in room ?
Which classes meet in room ?
Who is teaching ?
What subjects does teach?
In which classrooms does teach?
Who is taking ?
Which classes does take?
Who are the students of ?
Who are the teachers of ?
Query result
Result table to appear here.