In this lab, you will work on querying databases using relational algebra and SQL. The exercises in this lab are similar to the examples that you studied during the lecture. The purpose of the lab sessions is to get the hands-on experience that is required for future carrier.
The exercises in this lab are based on the university database from the Database System Concepts.
University database
Relational algebra
Write the following queries in relational algebra:
Find the titles of courses in the Comp. Sci. department that have 3 credits.
Find the IDs of all students who were taught by an instructor named Einstein.
Find the highest salary of any instructor.
Find all instructors earning the highest salary (there may be more than one with the same salary).
Find the enrollment of each section that was offered in Fall 2009.
SQL
For SQL, we will have two types of exercises. Type1, you need to interpret and understand the outcomes of an SQL Query. Type2, You will need to write your SQL query to extract specific piece of data.
Running SQL queries
To run these queries, download the university database univdb-sqlite.db from here. The database contains a table time_slot that is not included in the schema diagram. After that, execute these queries and describe the task that they are supposed to perform and comment on the query outputs.