CS 403 Assignment No 3 Solution Fall 2019
Assignment No. 03
SEMESTER Fall 2019
CS403- Database Management System
Total Marks: 20
Due Date:January 20, 2020
Please read the following instructions carefully before solving & submitting the assignment:
It should be clear that your assignment will not get any credit if:
- The assignment is submitted after the due date.
- The submitted assignment does not open or file corrupt.
- The assignment is full or partially copied. (from other student or ditto copy of the handouts or internet).
- The assignment is not submitted in .doc or .docx
- Assignment should be in .doc or .docx
- Save your assignment with your ID (e.g. BC123456789.doc).
- Assignment submission through email is NOT
The objective of this assignment is to able the Students:
- To understand the conversion of relational data model into physical database
- To implement the physical database by using the SQL Sever
- To understand and execute different SQL queries
|Lectures Covered: Lecture # 26 – 31|
Your assignment must be uploaded/submitted on or before January 20, 2020 (20/01/2020).
Our third assignment is the continuation of the second assignment. In the second assignment, we convert the ERD into a relational data model. The relational data model is given below:
Customer(Customer_ID, Name, Address, Contact_No, email)
Order(Order_ID, Order_Status, Delivery_Date, Customer_ID, Manager_ID,Sman_ID)
Bill(Bill_ID, Order_ID, Amount, date)
Bottle(Bottle_Tag_No, Fillling_Date, Expiry_Date, Capacity, Order_ID)
Manager(Manager_ID, Name, Address)
Salesman(Sman_ID, Name, Contact_No)
You’re required to perform the following tasks according to the above relational data model.
- Convert the above relational data model into a physical database. For which you have to first create a database. So, write a SQL statement which creates a database. The database name should be as your student id. For example, if your student id is BC123456789, then the database name should also be BC123456789.
*If database name is different from your student id, then your assignment will be graded as zero.
- After the database creation, you are required to write the SQL queries in order to create all tables in the database. You also have to apply different constraints like primary key constraint and foreign key constraints where applicable.
- After creation of all tables, you are required to add the following records into the Order, Customer and Bill tables by writing the appropriate SQL Queries.
|cust001||Customer 01||M.A Jinnah Campus, Defence Road,Off Raiwind Road, Lahoreemail@example.com|
|cust002||Customer 02||M.A Jinnah Campus, Defence Road,Off Raiwind Road, Lahorefirstname.lastname@example.org|
|cust003||Customer 03||M.A Jinnah Campus, Defence Road,Off Raiwind Road, Lahoreemail@example.com|
- Write a query that retrieves all records from the Order table where Order_Status is “Pending”.
- Finally retrive the “Completed Orders” in a inner joined table such as:
- Order_ID as OID from order table
- Order_Status as Status from order table
- Delivery_Date as Date from order table
- Customer_name as Name from customer table
- Amount as Bill Amount from Bill table
The expected outcome of the query is given bellow:
- You have to provide the snapshot of each task; otherwise your assignment will be graded zero.
- Only SQL Queries are allowed to perform the given tasks. Wizard usage is not allowed.
- Every Query and its execution snapshots are required in each task.
- Only SQL Server and SQL Management Studio are allowed to use for the solution of assignment.
First open the SQL Management Studio and connect to your SQL Server.
Then in the Object Explorer, right click and select the New Query in order to write different SQL Queries.
The SQL Query window will open and you can write different SQL queries in the highlighted area.
For example, a select query is applied on the Orders table to retrieve all the records of the table, then:
Query: SELECT * FROM orders;
The execution snapshot of the query is given below:
For any query about the assignment, contact at CS403@vu.edu.pk
Click Here For Solution File
For More Detail Watch Video: