0% found this document useful (0 votes)
34 views17 pages

DBS 2020-Arid-0125

The document is a midterm exam paper for a Database Systems course taken at PirMehr Ali Shah Arid Agriculture University in Rawalpindi, Pakistan. It contains instructions for both the teacher and student to fill out, addressing details like the course name and number, date of exam, student registration information, and a pledge about academic honesty. It then lists several multiple part questions for the student to answer related to entity relationship diagrams, database concepts, and creating an ERD to model a given problem description.

Uploaded by

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

DBS 2020-Arid-0125

The document is a midterm exam paper for a Database Systems course taken at PirMehr Ali Shah Arid Agriculture University in Rawalpindi, Pakistan. It contains instructions for both the teacher and student to fill out, addressing details like the course name and number, date of exam, student registration information, and a pledge about academic honesty. It then lists several multiple part questions for the student to answer related to entity relationship diagrams, database concepts, and creating an ERD to model a given problem description.

Uploaded by

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

PirMehr Ali Shah

Arid Agriculture University, Rawalpindi


Office of the controller of Examinations
Mid Exam / Spring 2021 (Paper Duration 12 hours)
To be filled by Teacher

Course No.: CS-400 Course Title: Database Systems .


Total Marks:______72_(18) ________Date of Exam:____ 28th April 2021 .
Degree: _____BSCS/BSIT_____Semester:_ 2nd ,3rd _ ___Section:__A, B,C,D_____ _____.
Marks Obtained Converted Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 / Obtained/
Total Marks Total Marks
Marks /72 /18
Obtained
Total Converted Marks in Words:
Name of the teacher: Dr. Naseer Ahmed, Zahid Ahmed, Jannat Khatoon
Who taught the course:Signature of teacher / Examiner:

To be filled by Student

Reg No.:2020-arid-0125 Name:Daniyal ATTIQ ……..Semester:3rd …Section:B

Notes:
1. By filling out your name and registration number above, you Pledge that: “I affirm
that I have not given or received any unauthorized help on this exam/assignment,
and that this work is my own.”
2. Any student found breaching the “Regulations Relating to the Examinations of
PMAS-Arid Agriculture University, Rawalpindi”, will face severe penalties.
3. Any form of Cheating, Unauthorized Help, and/or Plagiarism found in the Answers
given below will have severe penalty for the student, ranging from cancellation of
paper to suspension from the University rolls for up to 2 years.

Q.No.1 Analyze the given entity relationship diagram and answer the following questions.
[12 Marks]
a) What is the degree of “has” relationship?
b) Identify primary key(s)
c) Identify the category of each attribute
d) Name the cardinalities

Answer:
Q.No.2 Contrast among the following; [10 Marks]
a) Generalization; Specialization
b) Entity type ;Entity Instance
c) Primary key; Composite key
d) Relation; Relationship

Answer:
Q.No.3 Create an Entity-Relationship Model to represent the data requirements of the
problem given below. Specify the cardinalities of relationships and all-important
constraints. Also mention the assumptions if you have made any. [20 Marks]

A person can be an employee, alumnus or a student. For person P_id (identifier), date of
birth, gender and contacts are stored. Person can have more than one contact numbers and
there are no other types of person that exists. An instance of person can belong to more
than one type. Date hired and salary is the unique attributes of employee. For alumnus
degree is required to be stored that comprises of year and designation. Major department is
the attribute of student. A student can be a graduate student or an undergraduate student
but not both at the same time. No other type of student exists. For graduate student test
score is stored and for undergraduate student class standing is stored. Employee can be
faculty, staff or others but not both at the same time. For faculty rank is stored and for staff
position is stored. Undergraduate student can issue books from the library. An
undergraduate student can issue at most one book and a book is issued by no student or
one student. Issue date, return date and fine amount are stored when undergraduate
student issues a book. Book has attributes b_id, b_title and b_category and b_id is the
primary key for the book. Undergraduate student can get enrolled for more than one
courses and a course is enrolled by at least one undergraduate student. Course has
attributes course_id (identifier), credit, description and code. Courses can have one, none, or
many prerequisites. Each course is prerequisite of zero, one or many courses. Department offers
one or more courses and a course gets offered by one or many departments. Every instance
of department has unique dept_id and other attributes are name and location that needs to
be stored. Location is composed of city, postal code and zip code.

Answer:
Q.No.4 [30 Marks]

Patient Doctor

P_Id P_Name Gender Age


D_Id D_Fname D_Lname Salary City
1 Aqib Male 25
1 Laiba Hafeez 50000 Rwp
2 Saima Female 36

3 Fatima Female 29 2 Sameer Khan 80000 Isb

4 Nouman Male 31 3 Talib Ali 62000 Isb


5 Muneeb Male 40
4 Saleem Iqbal 77000 Multan
6 Tariq Male 38
5 Tania Abbas 85000 Lahore
7 Ikram Male 26

8 Sadia Female 27 6 Huda Ahmad 68000 Rwp

a) Write SQL queries for the following.


1) Display details of those patients whose age is either 25 or 36 or 29 without using
comparison operator.
2) Display first name and last name of those doctors whose salary is less than or equal
to 77,000 and greater than or equal to 50,000 using between operator.
3) Display details of those doctors who neither belong to Isb nor Rwp nor Multan
without using in and like operator.
4) Display full name of doctors whose first name is other than Tania.
5) Display first name of doctors whose first name contains any of vowels (a,e,i,o,u).
6) Display names of those patients whose name’s second letter is neither ‘a’ nor ‘d’
7) Display details of those male patients whose age is 25 or 36.
8) Display details of those patients whose name contains less than 5 characters.
9) Display first 4 doctors who are earning least salary.
10) Display details of all patients in such a way that female patients are shown before
male patients.
11) Display the unique cities from doctor table.
12) Display all patients.
13) Display details of all those doctors whose salary is greater than 50000 or live in Rwp
14) Display names of those patients whose names starts with either ‘a’ or ‘b’ or‘d’ and
don’t ends on‘s’.
15) Display 1/4 records of patients.

b) Assume the schema given above and identify the following queries are executable
or not. If yes then draw their results, if not then mention their errors.
1) Select * from patient where age between not 25 and 31;
2) Select D_Fname+’ ‘+D_Lname as [name] from doctor where D_Fname like
‘_[^ubs]%’ ;
3) Select P_Name, gender from patient where age in(25,29,38) or gender=’Mle’ ;

4) Select D_Id from doctor where salary >60000 and <80000;


5) Select * from doctor where city=’sib’ or city=’wrp’ ;

Answer:

You might also like