Professional Documents
Culture Documents
Teaching and Learning Solution: 1 Hpxs200-1-July-Dec2020-T&L-Memo-W9-Cmu-23092020
Teaching and Learning Solution: 1 Hpxs200-1-July-Dec2020-T&L-Memo-W9-Cmu-23092020
Suppose there is a Boston students’ table called tblStudents with the following columns:
• FirstName VarChar
• Surname VarChar
• Gender number where 0 = Male, 1 = Female, 2 = Not Provided
• SupportCentre VarChar
• Age number
• Course VarChar
a) All students from the database that are from the Johannesburg support centres (“Randburg”,
“Braamfontein”)
b) All students that are studying “Accounting”
c) Students whose age is between 20 and 30 years
d) Students in the order of their age from the youngest to the oldest
e) Students with surname that starts with letter “M”
f) Only the support centre and the course of the students who are female
SOLUTION
a. SELECT * FROM tblStudents where SupportCentre IN (“Randburg”, “Braamfontein”)
b. SELECT * FROM tblStudents where Course = “Accounting”
c. SELECT * FROM tblStudents where Age BETWEEN 20 and 30
d. SELECT * FROM tblStudents ORDER BY Age
e. SELECT * FROM tblStudents WHERE Surname LIKE “M*”
f. SELECT SupportCentre, Course FROM tblStudents WHERE Gender = 1
1 HPXS200-1-July-Dec2020-T&L-Memo-W9-CMu-23092020