



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of sql select statements and examples of queries on multiple tables in the context of a database systems course. It covers topics such as distinct and all keywords, where clauses, and joins. The examples use tables for students, grades, and courses.
Typology: Slides
1 / 5
This page cannot be seen from the preview
Don't miss anything!
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Student ID First Last S103 John Smith S104 Mary Jones S105 Jane Brown S106 Mark Jones S107 John Brown Course Code Title DBS Database Systems PR1 Programming 1 PR2 Programming 2 IAI Intro to AI
Grade ID Code Mark S103 DBS 72 S103 IAI 58 S104 PR1 68 S104 IAI 65 S106 PR2 43 S107 PR1 76 S107 PR2 60 S107 IAI 35
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Last Smith Jones Brown Jones Brown
Last Smith Jones Brown
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
ID Code Mark
S103 DBS 72 S104 PR1 68 S104 IAI 65 S107 PR1 76 S107 PR2 60
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Grade ID Code Mark S103 DBS 72 S103 IAI 58 S104 PR1 68 S104 IAI 65 S106 PR2 43 S107 PR1 76 S107 PR2 60 S107 IAI 35
ID Mark
S103 58 S104 65
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Student
ID First Last S103 John Smith S104 Mary Jones S105 Jane Brown S106 Mark Jones S107 John Brown
Grade
ID Code Mark S103 DBS 72 S103 IAI 58 S104 PR1 68 S104 IAI 65 S106 PR2 43 S107 PR1 76 S107 PR2 60 S107 IAI 35 G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
ID First Last ID Code Mark S103 John Smith S103 DBS 72 S103 John Smith S103 IAI 58 S103 John Smith S104 PR1 68 S103 John Smith S104 IAI 65 S103 John Smith S106 PR2 43 S103 John Smith S107 PR1 76 S103 John Smith S107 PR2 60 S103 John Smith S107 IAI 35 S104 Mary Jones S103 DBS 72 S104 Mary Jones S103 IAI 58 S104 Mary Jones S104 PR1 68 S104 Mary Jones S104 IAI 65 S104 Mary Jones S106 PR2 43
SELECT ... FROM Student, Grade WHERE...
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
ID First Last ID Code Mark
S103 John Smith S103 DBS 72 S103 John Smith S103 IAI 58 S104 Mary Jones S104 PR1 68 S104 Mary Jones S104 IAI 65 S106 Mark Jones S106 PR2 43 S107 John Brown S107 PR1 76 S107 John Brown S107 PR2 60 S107 John Brown S107 IAI 35
SELECT ... FROM Student, Grade WHERE (Student.ID = Grade.ID) AND ...
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
ID First Last ID Code Mark
S103 John Smith S103 DBS 72 S103 John Smith S103 IAI 58 S104 Mary Jones S104 PR1 68 S104 Mary Jones S104 IAI 65 S106 Mark Jones S106 PR2 43 S107 John Brown S107 PR1 76 S107 John Brown S107 PR2 60
SELECT ... FROM Student, Grade WHERE (Student.ID = Grade.ID) AND (Mark >= 40)
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Enrolment ID Code 123 DBS 124 PRG 124 DBS 126 PRG
Student ID Name
123 John 124 Mary 125 Mark 126 Jane
ID Name ID Code
123 John 123 DBS 124 Mary 124 PRG 124 Mary 124 DBS 126 Jane 126 PRG
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Property Address Price
15 High St 85, 12 Queen St 125, 87 Oak Row 175,
Buyer Name Budget
Smith 100, Jones 150, Green 80,
Name Budget Address Price Smith 100,000 15 High St 85, Jones 150,000 15 High St 85, Jones 150,000 12 Queen St 125,
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS
Track cID Num Title Time aID 1 1 Violent 239 1 1 2 Every Girl 410 1 1 3 Breather 217 1 1 4 Part of Me 279 1 2 1 Star 362 1 2 2 Teaboy 417 2
cID Title Price 1 Mix 9. 2 Compilation 12.
Artist aID Name 1 Stellar 2 Cloudboy
G52DBS – Database Systems www.cs.nott.ac.uk/~smx/DBS