University of Gujrat, Lahore Campus
Department of Software Engineering
Final Term Examination Spring 2021
Course Title: Introduction to Database Systems Marks: 50
Course Code: SE – 202 Time: 2.5 Hr
Program: BSSE Semester: Repeaters
Student Name: Student Roll No.
Attempt all twenty questions. Every question has 2.5 Marks.
Q1: Based on the given tables, how many records will be generated after executing the
following query? Also write the output generated by the same query.
Table Name: Student
ID Name Address
123 Ahmad Lahore
456 Kabir Quetta
Table Name: Mall
ShopID ShopName
1 RZY
2 ABC
3 XYZ
Query: SELECT * FROM Student, Mall
Q2: Based on the employee relation below, write SQL statement to find average salary of
employees in each project.
EMP(ID, Name, Proj_Name, Salary)
Q3: Consider the following TWO relations:
Instructor(ID, name, dept_name, salary)
Teaches(ID, course_ID, Sec_ID, Semester, Year)
Write SQL Query that WILL NOT successfully get instructors who have taught courses in
semester Fall 2020.
Intro. To Database (SE-202) – Final Term – Spring 2021
Q4: Based on the following Two Relations, HOW MANY NULL VALUES will be produced by
following query?
Table Name: Orders
Product Quantity OrderID
Wheel 100 123
Axle 10 123
Axe 20 999
Nut 50 999
Table Name: Pricing
product Price
Wheel 10
Axle 20
Net 2
Nail 3
Query: SELECT * FROM Orders natural left outer join Pricing;
Q5: After mapping the following ERD, write structure (table name & attributes) of
“Organization” relation.
Q6: Consider the given two relations, write output generated by following query:
Table Name: R
A B
1 B1
2 B2
4 B3
Intro. To Database (SE-202) – Final Term – Spring 2021
Table Name: S
A D
1 20
2 20
3 40
4 40
Query: SELECT D, COUNT(DISTINCT A) AS Count FROM S GROUP BY D;
Q7: “In SQL, We can write DDL and DML statements inside stored procedure”. Is this
statement true or false? Justify your answer.
Q8: After mapping the following ERD, Write attributes of the “Employee” relation:
Q9: Among these aggregate functions of SQL, which function does not ignore null values in
its results: Min(), Max(), COUNT(), DISTINCT
Q10: Consider the two relations: T(a, d, c) and S(d, b).
Assume that relation T has 7 rows and relation S has 9 rows.
What is the maximum number of rows that can be returned by executing the following query?
SELECT * FROM T NATURAL JOIN S;
Intro. To Database (SE-202) – Final Term – Spring 2021
Consider the following case study for Q11 – Q15:
Organization made up of various departments, each having a name, identifying no., and
an employee who is the manager. A department may be located in different places.
Information about employee includes name, identification number, birth date, address,
sex, and salary. Each employee is assigned to one department. The date the manager
is appointed to a department is also tracked. Employees may be directly supervised by
another employee. Each project within the organization is controlled by a department.
Employees (not necessarily from the controlling dept.) are assigned to projects.
Information about projects includes project name, no., and location. Hours spent by
employees on each project are also kept.
Q11: Identify Entities in given case.
Q12: Identify Attributes and their types of every entity.
Q13: Identify Primary Keys and Foreign Keys for all relations.
Q14: Draw Entity Relationship Diagram (ERD).
Q15: Write DDL queries to construct database structure.
Q16: Write difference between single valued attribute and multi valued attribute.
Q17: What are views in database?
Q18: How consistency is maintained in database?
Q19: “WHERE clause is used always after GROUP BY clause”. Is this statement true or
false? Explain your answer
Q20: Differentiate between Cartesian Product and Join condition?
<< END OF PAPER >>
Intro. To Database (SE-202) – Final Term – Spring 2021