Assignement 2
Assignement 2
Assignment 2
SECTION- A
1. Explain basic relational algebra operations and explain them?
2. Define the data, database and database management system.
3. Write ten applications area of DBMS,
4. Discuss the advantages and disadvantages of DBMS.
5. What are the database languages? Describe the types of languages.
6. Define the super key, candidate key and foreign key.
7. What are data models? Describe in brief.
8. Describe the types of database user on the basis of their work.
SECTION - B
9. Consider the following relations for a database that keeps track of student enrollment
in courses and the books adopted for each course-
STUDENT(SSN, Name, Major, Bdate)
COURSE (Course#, Cname, Dept)
ENROLL( SSN, Course#, Quarter, Book_ISBN)
TEXT( Book_ISBN, Book_Title, Publisher, Author)
Specify the foreign keys for this schema. Write SQL-DDL statement for creation of
above relations. Illustrate integrity constraints as deem fit for above database.
10. Consider the following relational database, where the primary keys are underlined
Employee(person_name, street, city)
Works(person_name, company_name, salary)
Company(company_name, city)
Manages(person_name, manager_name)
Give an expression in the relational algebra and SQL statements to express each of
the following queries:
1|Page
a. Find the name of all employees who live in the same city and on the same
street as do their managers.
b. Find the name of all employees in this database who do not work for “First
Bank Corporation”.
c. Find the name of all employees who earn more than every of “Small Bank
corporation”.
d. Give all managers in this database a 10 percent salary raise.
e. Find the name of all employees who work for “First Bank Corporation”.
f. Find the name, street and cities of residence of all employee who work for “First
Bank Corporation and earn more than 10000 per annum.
g. Find the name of all employees who live in the same city as the company for
which they work.
h. Delete tuples in the relation works for employees of “Small bank Corporation”.
i. Assume the companies may be located in several cities. Find all companies
located in every city in which “Small Bank Corporation” is located.
j. Give all managers in this database a 10 percent salary raise, unless the salary
would be greater than 100000. In such case, give only a 3 percent raise.
k. Find the company with the most employees.
l. Find those companies whose employees earn a higher salary, on average , than
the average salary at “ First Bank Corporation”.
11. Draw an ER diagram for a railway reservation system having the following
information : ( Explain your assumptions clearly, if any)
a) The train starts from a city station identified by the station_ID.
b) Each train has a train_number, a name, and mention the numbern of seats
available in three classes of service and the number of comportments assigned
to each class.
c) Each train has a route which consists of a series of stations.
d) Based on the type of reservation, there is a fixed fare between each pair of station
along the route.
e) The type of reservation depends on the day the week on which the train operates.
f) The train has scheduled arrival and departure time for each station.
g) During reservation, the customer name, phone number and address are recorded.
2|Page
h) The reservation provides a seat_number/sleeper_number.
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.
Give relational Algebra expression and SQL statements to express each of the
following queries:
3|Page
SECTION – B (Laboratory)
Write SQL (DDL) statement to create above tables. Include integrity constraints
wherever required for Q9, Q10, Q12 and Q13.
4|Page