CS403 Assignment No 2
CS403 Assignment No 2
02 (Graded)
Fall 2024
CS403- Database Management System
Question NO 1
You are required to select the correct SQL query from the Table title ‘List of Queries’ and then fill out the Table named
‘Tasks’ with the proper serial number:
List of Queries
5 SELECT Title, Price FROM Books WHERE Category = 'Fiction' AND Price > 500;
6 INSERT INTO Books (BookID, Title, Author, Category, Price, Stock) VALUES ('B001', 'Database Systems',
'Salman', 'Technology', 1000, 20);
7 CREATE TABLE Members (MemberID VARCHAR(100), Name DATE, Email INT, JoinDate INT
8 DELETE FROM Borrowings WHERE ReturnDate < '2024-01-01';
9 CREATE TABLE Books (MemberID INT PRIMARY KEY, Name VARCHAR(100), Email VARCHAR(100),
JoinDate DATE );
10 UPDATE Members SET Email = '[email protected]' WHERE MemberID = 'M002';
15 SELECT Title, Price FROM Books WHERE Category = 'Technology' AND Price < 500;
Solution:
Tasks
1 Create a table named Members with the schema described above, including primary key
3
and any foreign key relationships if applicable.
2 Insert a new record into the Books table with the following details: BookID = 'B001', Title =
6
'Database Systems', Author = 'Salman ', Category = 'Technology', Price = 1000, Stock = 20.
3 Delete all records from the Borrowings table where the ReturnDate is earlier than January
8
1, 2024.
4 Update the Email of a member in the Members table with MemberID = 'M002' to
10
'[email protected]'.
5 Retrieve the Title and Price of all books in the Books table where the Category is 'Fiction'
12
and the Price is less than 500.