$24
• INSTRUCTIONS
(1) This lab is graded. Each question carries 2 marks. Maximum marks: 10
(2) Download and install MySQL. If it is not possible to install MySQL on your laptop, install SQLite.
(3) The data to be used are given to you.
• QUESTIONS
Consider the following tables:
Student(snum: integer, sname: string, major: string, level:
string, age: integer)
Class(name: string, meets_at: time, room: string, fid: integer)
Enrolled(snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
The meaning of these tables is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class.
.
1
2
Write a program in any language you are familiar with that answers the following questions. You can write separate pro-grams or have the same program answer all the questions. For the questions below, you may be asked to replace the values “18”, “Database Systems” or “20” by other values.
(1) Find the names and ages of all students.
(2) Find all students whose age is above 18. (List their serial numbers, names, major, level and age).
(3) Find the serial numbers of all students who have enrolled for “Database Systems”.
(4) Find the names of all students who have enrolled for “Data-base Systems”.
(5) Find the names of all faculty members who belong to the department “20”.