









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Fifth Semester 2013
Examination: B.S. 4 Years Programme
I. Write a query to show the location & name of those whose salary is less than the salary of King.
II. Show the salary Grade of all employees whose salary is greater than the salary of King, Ford and Michel.
III. Show the name and job title of all those employees whose name is containing ‘Z’ or at fifth place having ‘S’
or starting with ‘Y’ or having two A’s in it and job title is greater than Accounts.
IV. Display the name of all those employees who join the company after six month of King and currently
serving in Lahore.
V. Display the name of those employees whose salary is greater than average salary of all departments and
less than the salary of maximum salary of all departments.
Schema:
Emp (Empno, Ename, sal, comm, deptno, mgr, job, HireDate)
Dept (Deptno, Dname, Loc)
SalGrade (Hisal, Losal, SalGrade)
CourseID
Name Age Student NIC CourseName Grade Skills
Roll NO. _________________
A customer is someone who places, has placed or may place orders with the company. A regular customer places
orders at regular intervals. An order is placed by one customer only, so two or more customers cannot place an
order jointly. Note the some customers may not have placed an order yet. A customer can operate at a number of
sites. The delivery address is included on the customer order.
Each order will request product items. Most orders will request several product items, and an order must request at least one product item. A particular product item may be requested on several orders. Product items are organized into product types. Each product item will be of a specific type. Product types organize product items into specific categories (e.g. Beans, Cereals, and Pet Food etc. ). Each product item is supplied by a single supplier may supply several different product types.
Each order consists of a number of requests for items, known as order items. Each order will have at least one order item. Most orders will consist of many order items. Each order item relates to a particular product item that has been requested. A product item can be requested on several orders and thus several order items.
Q5: Explain Transaction. What are ACID properties of transaction? (8 marks)
Q6: What is meant by ANSI SPARC Architecture explain 3 layers describe in it? (7 marks)
Q7: During transformation which entities, relationships and attributes form new tables (Relations)? (5 marks)
sailor sname rating
Brutus 1
Andy 8
Horatio 7
Rusty 8
Bob 1
reservation sname bname weekday
Andy Interlake Monday
Andy Bay Wednesday
Andy Marine Saturday
Rusty Bay Sunday
Rusty Interlake Wednesday
Rusty Marine Wednesday
Bob Bay Monday
Figure 1: Database instance for Question 2
Write the following queries in SQL (of course, the queries must work on all data, not just the sample one):
boat bname color rating
SpeedQueen White 9
Interlake Red 8
Marine Blue 7
Bay Red 3
a) (2 points) List all boats reserved on Wednesday and their color.
b) (2 points) List all sailors never reserve a boat on Friday.
c) (2 points) Write a query to tell sum of sailor reserve boat on Wednesday.
d) (2 points) For each day, list the number of red boats reserved on that day.
e) (2 points) Write a query to find the sum of reservation in which Andy reserve Interlake or Speed Queen
boat.
Consider the following relations:
Emp (eno, ename, title, city)
Proj (pno, pname, budget, city)
Works (eno, pno, resp, dur)
Pay (title, salary)
Where the primary keys are underlined, and Emp.title is a foreign key to Pay.title, Works.eno is a foreign
key to Emp.eno, and Works.pno is a foreign key to Proj.pno.
For each part of this question (considered independently of the other parts), write a single SQL statement
that accomplishes the given requirements.
a) (3 points) For each city, how many projects are located in that city and what is the total budget
over all projects in the city?
b) (3 points) List all projects located in “Lahore”.
c) (4 points) Write a query to the name of employees working in cadcam proj and their city is not
Lahore and resp is manager and salary is less than 20000.
Fifth Semester 2015
Examination: B.S. 4 Years Programme
Q 2: Give Answer of following Questions? (5x4 marks)
Write Queries for the given statements
Descending Order.
are not working on CAD/CAM project.
to this employee and show the attribute with the heading Bonus + Salary with rounding the digit after 1st^ place
of decimal.
Q 3: Draw E-R Diagram for following scenario. (10 marks)
Our client “XYZ Ltd.” is starting rent a car Business. Initially they will have one office in Lahore. They will have cars of
different models from different makers. Customers can have a car on rent for some period from their office and will
return the car at the office after use. Customers will be charged on hourly bases. There will also be some discount
packages for customers in which they will initially pay a specific amount and will be given a specific discount on each
bill.
Roll NO. _________________
Q 4: Normalize the following relation and also explain each normal form? (5 marks)
Q5: Explain ANCI SPARC ARCHITECTURE? (8 marks)
Q6: What is meant by ACID properties of Transaction? (7 marks)
Table for Queries
Pay ASG
Book-
id
Book-name price Writer-id publisher Book Type Writer Name
Eno Pno Resp Dur.
E
P1 Manager 12
E
P1 Analyst 24
E
P2 Analyst 8
E
P3 Consultant 24
E
P4 Engineer 16
E
P2 Programmer 18
P2 Manager 0
E
P4 Engineer 36
Title
Sal
Elect. Eng.
40000
Syst. Anal.
34000
Mech. Eng.
27000
Programmer
24000
Scanned by CamScanner
Scanned by CamScanner