Assignement 1
Assignement 1
Assignment 1
1. List and explain four significant differences between a file-processing system and a
DBMS.
2. Explain the difference between physical and logical data independence.
3. What are five main functions of a database administrator?
4. Explain the differences between relation and relation schema.
5. List major steps that you would take in setting up a database for a particular
enterprise.
6. Explain the distinctions among the terms primary key, candidate key, and super key.
7. Design a relational database for examination office of your university. The
information about the students, class, time, room, subject and professors etc. are to
be stored. At the end of the semester each student is awarded a grade for his/her
performance in the class. (Hint. The database consists of several relations. Outline
various key and integrity constraints)
8. Design a database for the accident monitoring system for transport police. A person
may own a car of several brands and a particular vehicle may have encountered with
an accident.
9. Consider following database for an organization that maintains the information about
various employees working for different companies and their managers.
Give an expression in the relational algebra and SQL to express each of the following
queries:
1|Page
a) Find the names of all employees who work for Union Bank.
b) Find the names and cities of residence of all employees who work for State bank.
c) Find the names, street address, and cities of residence of all employees who work
for Union Bank and earn more than USD1000.
d) Find the names of all employees in this database who live in the same city as the
company for which they work.
e) Find the names of all employees who live in the same city and on the same street
as do their managers.
f) Find the names of all employees in this database who do not work for Union
Bank.
g) Find the names of all employees who earn more than every employee of HSBC
Bank.
h) Assume the companies may be located in several cities. Find all companies
located in every city in which HSBC is located.
i) Modify the database so that Jones now lives in Newtown.
j) Give all employees of Union Bank a 10 percent salary raise.
k) Give all managers in this database a 10 percent salary raise.
l) Give all managers in this database a 10 percent salary raise, unless the salary
would be greater than $100,000. In such cases, give only a 3 percent raise.
m) Delete all tuples in the works relation for employees of Union Bank.
n) Find the company with the most employees.
o) Find the company with the smallest payroll.
p) Find those companies whose employees earn a higher salary, on average, than the
average salary at Union Bank.
Flights ( flno : integer, aid : integer, from : string, to : string, distance : integer,
departs : time, arrives : time, price : real)
Aircraft (aid : integer, aname : string, cruisingrange : integer)
Certified (eid : integer, aid : integer)
Employees (eid : integer, ename : string, salary : integer)
Note that the Employees relation describes pilots and other kinds of employees as
well; every pilot is certified for some aircraft, and only pilots are certified to fly.
2|Page
Give an expression in relational algebra and SQL for following:
a) Find the names of aircraft such that all pilots certified to operate them have
salaries more than $80,000.
b) For each pilot who is certified for more than three aircraft, find the eid and the
maximum cruising range of the aircraft for which she or he is certified.
c) Find the names of pilots whose salary is less than the price of the cheapest
route from Los Angeles to Zurich.
d) For all aircraft with cruising range over 1000 miles, find the name of the
aircraft and the average salary of all pilots certified for this aircraft.
e) Find the names of pilots certified for some Boeing aircraft.
f) Find the aids of all aircraft that can be used on routes from Los Angeles to
Chicago.
g) Identify the routes that can be piloted by every pilot who makes more than
$100,000.
h) Print the names of pilots who can operate planes with cruising range greater
than 3000 miles but are not certified on any Boeing aircraft.
i) A customer wants to travel from San Francisco to New York with no more than
two changes of flight. List the choice of departure times from San Francisco if
the customer wants to arrive in New York by 6p.m.
j) Compute the difference between the average salary of a pilot and the average
salary of all employees (including pilots).
k) Print the name and salary of every non pilot whose salary is more than the
average salary for pilots.
l) Print the names of employees who are certified only on aircrafts with cruising
range longer than 1000 miles.
m) Print the names of employees who are certified only on aircrafts with cruising
range longer than 1000 miles, but on at least two such aircrafts.
n) Print the names of employees who are certified only on aircrafts with cruising
range longer than 1000 miles and who are certified on some Boeing aircraft.
3|Page
SECTION – B ( Laboratory)
Write SQL (DDL) statement to create above tables. Include integrity constraints
wherever required for Q7,Q8,Q9 and Q10.
4|Page