Question: Question 3 Write the DML codes to create each of the tables shown above [4 Marks] Write the DDL codes to insert the data into
Question 3
- Write the DML codes to create each of the tables shown above [4 Marks]
- Write the DDL codes to insert the data into the tables as shown above. [4 Marks]
c) Identify the Superkeys for staff relation. [5 Marks]
d) Based on the tables of the above given schema, write SQL integrity enhancement features for the following constraints:
- bookID in Borrow must be the one that exist as code in Book .
- Salary must be an integer value above 0.
- joinedDate is not present or future dates. [12 Marks]
Question 4
- Based on the table given above provide the relevant relational algebra operations that is been described in the following statements:
- List all employees in the library whose salary are greater than 2000.00.
- Marks]
- Produce a list of students, showing only the student id, name and contact number.
- Marks] iii. List the book title and publisher that students had borrowed (No title should be repeated).
[5 Marks]
- Using the Book, Student, Staff and Borrow tables above, derive the output of the following relation algebra operation:
- publisher = Oxford AND pubYear >=2005(Book) [2 marks]
- title, author, publisher (Book) [2 marks]
- Result1 state = Penang (Staff)
Result2 state = Penang (Student)
FinalResult sName (Result1) sName (Result2) [3 marks]
-
( studentID,bookID(Borrow))(
(bookID)(
| id |
| ( |
publisher = Addison Wesley (Book))))
[3 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
