0% found this document useful (0 votes)
28 views3 pages

Fall 2024 - CS403P - 2

Uploaded by

Muhammad Rashid
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)
28 views3 pages

Fall 2024 - CS403P - 2

Uploaded by

Muhammad Rashid
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/ 3

Virtual University of Pakistan 1

Assignment No. 02 (Graded) Total Marks: 20


Fall 2024
Due Date: 02-Jan-2025
CS403P- Database Management System (Practical)

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 copied 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:

 Analyze real-life scenarios and learn SQL query writing skills.


 Know and apply various features of SQL on given database tables.
 Understand how Join query, its variants work.
 Apply Join query on prescribed database tables.

Content Covered: This assignment covers Lectures 21 to 32 of CS403 course.


Deadline: Your assignment must be uploaded/submitted on or before the due date.

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

GOOD LUCK
Virtual University of Pakistan 2

Question No. 1 Marks 10


Suppose you have joined a nationwide logistics company as Database Developer / Administrator. This company
manages package deliveries across several cities. As a part of their web solution, SQL database is deployed at
backend. They have a database table called Packages with the following columns / attributes:

 PackageID (INT, Primary Key): Unique identifier for each package.


 SenderCity (VARCHAR): City where the package was sent from.
 RecipientCity (VARCHAR): City where the package is being delivered to.
 ShippingDate (DATE): Date when the package was shipped.
 DeliveryDate (DATE): Date when the package was delivered.
 Weight (DECIMAL): Weight of the package in kilograms.
 Status (VARCHAR): Current status of the package (e.g., "In Transit", "Delivered", "Delayed").
 VehicleType (VARCHAR): Type of vehicle used for delivery (e.g., "Truck", "Van", "Plane").

Task: You are required to execute a single SQL command satisfying the following requirements i.e., A single
SQL query should fulfill all the requirements.

1. Find all the unique sender cities from which packages have been shipped.
2. Find all packages that were not delivered by van.
3. Find all packages that were shipped between Mar 01 st, 2024 and Mar 29th, 2024 (inclusive). Follow the
order date as YYY-MM-DD.
4. Find all delivered packages, ordered by their delivery date, with the most recent deliveries appearing first.

Note: Don’t write separate commands. All the four requirements should be met in single SQL Query.
Virtual University of Pakistan 3

Question No. 2 Marks


10
Imagine we have two tables (Employees and Departments) in a organization. The structure of tables is as follows:

Employees Table
EmployeeI FirstNa LastNa DepartmentI Salar
D me me D y
1 John Smith 1 6000
0
2 Jane Doe 2 7500
0
3 David Lee 1 6500
0
4 Sarah Jones 3 8000
0
5 Michael Brown NULL 5500
0

Departments Table
DepartmentI DepartmentName Location
D
1 Sales New York
2 Marketing London
3 Engineering Paris

Task: You are required to write down the SQL query to Retrieve names and their respective departments of all
the employees. You should also show the output table of the query. Remember, we don't want to include
employees who might have null value (for Department ID).

Lectures Covered: This assignment covers Lectures 21 to 32 of CS403P course.


Deadline: Your assignment must be uploaded/submitted on or before the due date 02-Jan-2025.

You might also like