0% found this document useful (0 votes)
2K views3 pages

DB HW2

The document provides instructions for homework assignments on relational database schemas and SQL queries and updates. It asks the student to specify referential integrity constraints and generate SQL statements to declare the schema, retrieve data through queries, and modify data through inserts, updates and deletes. It focuses on a LIBRARY database schema and performing various queries and updates on a university student and course database schema.

Uploaded by

Rodaina Hesham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views3 pages

DB HW2

The document provides instructions for homework assignments on relational database schemas and SQL queries and updates. It asks the student to specify referential integrity constraints and generate SQL statements to declare the schema, retrieve data through queries, and modify data through inserts, updates and deletes. It focuses on a LIBRARY database schema and performing various queries and updates on a university student and course database schema.

Uploaded by

Rodaina Hesham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Homework #2 (Chapter 4)

7. Consider the LIBRARY relational database schema shown in Figure 4.6. Choose
the appropriate action (reject, cascade, set to NULL, set to default) for each
referential integrity constraint, both for the deletion of a referenced tuple and for
the update of a primary key attribute value in a referenced tuple. Justify your
choices.

8. Write appropriate SQL DDL statements for declaring the LIBRARY relational
database schema of Figure 4.6. Specify the keys and referential triggered actions.
12. Specify the following queries in SQL on the database schema of Figure 1.2.

a. Retrieve the names of all senior students majoring in ‘CS’ (computer science).
b. Retrieve the names of all courses taught by Professor King in 2007 and 2008.
c. For each section taught by Professor King, retrieve the course number,
semester, year, and number of students who took the section.
d. Retrieve the name and transcript of each senior student (Class = 4) majoring in
CS. A transcript includes course name, course number, credit hours, semester,
year, and grade for each course completed by the student.

13. Write SQL update statements to do the following on the database schema shown
in Figure 1.2.
a. Insert a new student, <‘Johnson’, 25, 1, ‘Math’>, in the database.
b. Change the class of student ‘Smith’ to 2.
c. Insert a new course, <‘Knowledge Engineering’, ‘CS4390’, 3, ‘CS’>.
d. Delete the record for the student whose name is ‘Smith’ and whose student
number is 17.

You might also like