Creating and Modfying the Tables in Databases

In this lab, you will work on creating tables (relations) and adding/deleting records to/from the tables. You will learn also how to modify a database by altering the tables (adding/deleting attributes) or even deleting the whole table. When writing the SQL queries, it is good to keep a copy of the queries in a plain text document so that you can use them later (if needed).

Note: we will use table and relation exchangeable unless something else is specified.

Creating table

During the first weeks of the course, we will use the University database from the Database System Concepts book. Over the first two weeks of the course, it would be good to create all the tables and enter a few records in the student, instructor and department relations.

  • Write the SQL query that creates one or more tables. For now, you don’t need to specify the primary/foreign keys or any additional constraints. Just the data type of each attribute.