SQL Lab 1
This lab uses the enrollment data.
Only turn in the sql statements (not the results of the query). You may test your queries out online. (But remember, just because you get the right data back, that does not mean your query is correct!). Turn in an electronic copy of your .sql file. Include your name and label each question (using comments).
Questions:
- Display all the courses you have taken (course id, section id, and semester) ordered by course_id. You can first look up your id number in the student table. (It may be different from what you use at your institution for privacy reasons). If you prefer, you can do it for any one student of your choice instead.
- Find the ids of instructor Kean and instructor Choll. Use that information to display the courses taught by Kean in Fall 2003 or Choll in Spring 2002.
- Find the id of instructor Voronina and use it to display the ids of students who were in a music or accounting course taught by Vornina in Fall 2006. Do not use an IN operator.
- Repeat the previous question using the IN operator.
- Display all courses taught within the Comp. Sci. department that are lower level (not 300 or above).
- Display the names and IDs of all professors in one column with just a space separating the two.
- Display all the courses (course_id) that have been taught at least once without an assigned location.
- Display all the different unique combinations of semesters and buildings have been taught at the university. What results might be consider missing?
- (Bonus) Find students who have taken courses taught by both Tung and Dale.