0% found this document useful (0 votes)
12 views4 pages

Fall 2024 - CS403 - 2

Uploaded by

mmohsinali087
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Fall 2024 - CS403 - 2

Uploaded by

mmohsinali087
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Virtual University of Pakistan 1

Assignment No. 02 (Graded) Total Marks: 20


Fall 2024
Due Date: 02-Jan-2025
CS403- Database Management System

Instructions:

Please read the following instructions carefully before solving & submitting the assignment solution:

It should be clear that your assignment will not get any credit (zero marks) if:

o The assignment is submitted after the due date.


o The submitted assignment solution does NOT open, or the file is corrupt.
o The assignment is copied (from other students or ditto copy from handouts or the internet).
o Please ensure that your assignment submission is in .doc or .docx format. Other formats such as scanned
images, PDFs, .zip, .rar, .bmp, etc., will not be accepted.

Objectives:

The objectives of this assignment are:

 To help students understand the concept of Structured Query Language (SQL).


 How to create tables, insert data into tables and then query data that satisfies the user requirements.

For any query about the assignment, contact at [email protected]

GOOD LUCK

Marks: 20

Assignment no. 2
Virtual University of Pakistan 2

The following database tables with their structure will be used.

1. Books

o BookID (Primary Key)

o Title

o Author

o Category

o Price

2. Members

o MemberID (Primary Key)

o Name

o Email

o JoinDate

3. Borrowings

o BorrowingID (Primary Key)

o MemberID (Foreign Key)

o BookID (Foreign Key)

o BorrowDate

o ReturnDate

4. Authors

o AuthorID (Primary Key)

o AuthorName

o Country

Assignment no. 2
Virtual University of Pakistan 3

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

Sr. No. SQL Query

1 DELETE FROM Borrowings WHERE ReturnDate < '2022-01-01';

2 INSERT INTO Books (BookID, Title, Author, Price, Stock) VALUES (B001, 'Database Systems',
'Salman', '1000', '20');

3 CREATE TABLE Members (MemberID INT PRIMARY KEY, Name VARCHAR(100), Email
VARCHAR(100), JoinDate DATE );
4 UPDATE Members SET Email = '[email protected]' WHERE MemberID = 'M006';

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';

11 DELETE FROM Borrowings WHERE IssueDate < '2024-01-01';

12 SELECT Title, Price FROM Books WHERE Category = 'Fiction' AND Price < 500;

13 INSERT INTO Authors (BookID, Title, Author, Category, Price, Stock) VALUES (B001,
'Database Systems', 'Salman', Technology, '1000', '20');

14 UPDATE Members EDIT Email = '[email protected]' WHERE MemberID = 'M002';

15 SELECT Title, Price FROM Books WHERE Category = 'Technology' AND Price < 500;

Assignment no. 2
Virtual University of Pakistan 4

Sample
Tasks Task

Task Statement SQL Command


Sample Delete records from the Borrowings table where the ReturnDate is earlier than
1
January 1, 2022

1 Create a table named Members with the schema described above, including primary
key and any foreign key relationships if applicable.

2 Insert a new record into the Books table with the following details: BookID = 'B001',
Title = '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 1, 2024.

4 Update the Email of a member in the Members table with MemberID = 'M002' to
'[email protected]'.

5 Retrieve the Title and Price of all books in the Books table where the Category is
'Fiction' and the Price is less than 500.

Note: Do not write the complete SQL Query in ‘SQL Command’ Column in the above table. Only write the correct
query’s serial no. as written in the sample task.

Lectures Covered: This assignment covers Lectures # 23 - 30.


Deadline: Your assignment must be uploaded or submitted on or before the due date: Thursday, 2nd
January 2025.

Assignment no. 2

You might also like