Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Introduction to Database System

Spring 2023
Midterm Lab
VERSION I

Time Allowed: 1.5 hours


Name: Atif Hussain

Registration No L1S22BSCS0267

Serial Number (of


attendance sheet)

DDL DML ERD Overall


Total Marks 20 20 10 50
Ob. Marks

Instructions:
1) This is a closed book, closed notes paper.
2) Understanding questions is part of the paper. Therefore, no queries will be entertained during
examination.
3) Swirl.sql file is uploaded on teams/portal. Use those files to attempt the DML section of paper.
4) Use proper indentation/formatting while writing queries. Not properly indenting will deduct 5%
marks.
5) You need to make an MS Word with your name and registration should be mentioned on each
page.
6) You need to write only queries with output in MS Word file, you need to write query (text
form) + its output table (picture) if any.
7) You will solve the DDL + DML section only in pdf file.
Part 1 DDL [20 Marks]

Q1. Implement the above tables with its attributes. input data
(minimum 3 user) ,create Reverse Engineer image and paste into
PDF file. (12)
Q2. Change the variable name of rowID to RID and datatype from int to
varchar (5) in Rows table. (3)
Note: Do these in one Query only.
Q3. Add all primary key and foreign key using alter command. (5)

Page 2 of 6
Part 2 DML [20 Marks]

 Import Swirl.sql schema.

Page 3 of 6
Page 4 of 6
Solve the following questions from the above schema: (5+5+5+5)
Q1. Write a query to show all the data of Employe except for those with names
"King " and "Park", without using the <> and != operators.
Q2. Write a query to displays all data of invoices Details whose CustomerId is
between 40 to 50.
Q3. Write a query to display the information of employees whose names consist
of exactly 4 characters and start with the letter 'p'.
Q4. Write a query to show all record from track which exact match from the table
mediatype .

Part 3 ERD [10 Marks]

Draw ERD Diagram on paper.

The system tracks product information, including product name (primary key), product ID,
and quantity on hand. Products are composed of various components, with component
information stored, including component ID (primary key), name, description, and the
products in which they are used. Components can be supplied by one or more suppliers.
Components may or may not be associated with suppliers, and not all components are used
in products. However, products cannot exist without components, establishing a mandatory
one-to-many relationship between products and components.
Find Some Data
1. Entities correctly identified: (1)
2. Attributes correctly identified: (1)
3. Primary keys correctly identified: (1)
4. Relationships and cardinality correctly identified (1)
5. ENTITY-RELATIONSHP DIAGRAM (6)

Page 5 of 6
Entity Relationship Attributes
Product Made of different pname (primary key), pID ,
components(1:M) pquantity
Component Can be supplied by one cID (primary key), cName,
or more suppliers description, products in
which used
Supplier Supplies
components(M:1)

Page 6 of 6

You might also like