Test2 Chap5678 HonsDBMS-11feb25
Test2 Chap5678 HonsDBMS-11feb25
5 hr
1. Explain the following with an example
a. DROP command with cascade option in SQL.
b. ALTER command to modify a column to change its datatype and add NOT NULL condition.
c. RENAME a table name. (6)
2. Consider the following Tables:
Musician SSN Name Address Phone
Instrument InstrumentName MusicalKey
Album AlbumId Title CopyrightDate Format ProducerSSN
Song SongId Title Author AlbumId
Plays SSN InstrName
Performs SSN SongId1
Write SQL query for the following:
a. List the names of all musicians who play the 'Guitar'."
b. Find the titles of all songs written by 'John Lennon' that are on albums produced by 'Paul McCartney'.
c. List the names of all instruments played by 'Jimi Hendal'
d. Find the number of songs on each album.
e. List the names of musicians who have performed on more than 5 songs. (10)
3. Consider the following schema:
Sailors (Sailor_id, Sname, Rating, Age)
Boats (Boat_id, Bname, Color)
Reserves (Sailor_id, Boat_id, Date)
Write the following queries in RELATIONAL ALGEBRA:
a. Find the names of sailors who have reserved boat 102.
b. Find the names of sailors who have reserved a blue or a yellow boat.
c. Find the Sailor_id of sailors with age over 30 who have not reserved a red boat. (6)
SHIPMENT SUPPLIER
SNo PartNo PjNo Qty SNo SName Status City
S345231 P123 R49 4 S127890 Sharma 3 Goa
S562459 P145 R93 8 S345231 Gupta 2 Madras
S127890 P145 R78 2 S562459 Panigrahi 1 Delhi
S562459 P459 R49 5 S321458 Verma 2 UP
a. UPDATE SHIPMENT SET Qty = 5.5 WHERE SNo = 'S345231' AND PartNo = 'P123' AND PiNo = 'R49';
b. INSERT INTO SHIPMENT VALUES ('S562459', 'P459', 'R79', 10);
c. INSERT INTO PART VALUES ('P145', 'Wheel', 'Silver', '2.5 Kg');
d. INSERT INTO SUPPLIER VALUES (NULL, 'New Supplier', 3, 'London');
e. DELETE FROM PART WHERE PartNo = 'P490'; (5)
5. Consider the following relations for a database that keeps track of student enrollment in courses
and the books adopted for each course:
Student (Ssn, Name, Major, Bdate)
Course (Course#, Cname, Dept)
Enroll (Ssn, Course#, Semester, Grade)
Book_Adoption (Course#, Semester, Book_isbn)
Text (Book_isbn, Book_title, Publisher, Author)
Specify the primary keys and foreign keys for this schema, stating any assumptions you make. (5)