You are on page 1of 3

MODULE-3

1a Consider the Sailors-Boats-Reserves Database as below:


sailors (sid, sname, rating, age)
boats (bid, bname, color)
reserves (sid, bid, date)

Write each of the following queries in SQL.


1. Find the colors of boats reserved by Sachin.
2. Find all sailor id’s of sailors who have a rating of at least 8 or reserved boat
103.
3. Find the names of sailors who have not reserved a boat whose name contains the
string “storm” in ascending order.
4. Find the sailor id’s of sailors whose rating is better than some sailor called
Bob.

1b Write short notes on UNIQUE and NOT NULL constraints.

2a Consider the Employee Database as below:


Employee (emp_name, street, city, date_of_joining)
Works(emp_name, company_name, salary)
Company (company_name, city)
Manager (emp_name, manager_name)

Write each of the following queries in SQL:


1. Modify the database so that “Deepa” lives in “Pune”.
2. Give all employees of “XYZ corporation” a 10% rise in salary.
3. Display all employees who joined in the month of “March”.
4. Find all employees who earn more than average salary of all the employees of
their company.
5. List all employee who lives in the same city as their company city.

2b Explain Commit, Rollback and Savepoint with an example.

3a Consider the following relations:


Student(snum: integer, sname: string, major: string, level: string, age: integer)
Class(name: string, meets at: string, room: string, fid: integer)
Enrolled(snum: integer, cname: string)
Faculty(fid: integer, fname: string, deptid: integer)

Write each of the following queries in SQL:


1. Find the names of all Juniors (level = JR) who are enrolled in a class taught by
Mr.Nitin.
2. Find the names of faculty members for whom the combined enrollment of thecourses
that they teach is less than five.
3. Find the names of students not enrolled in any class.
4. Find the names of faculty members who teach in every room in which some class is
taught.

3b Explain the concept of cursors with examples.

4a Consider the following relations:


Flights(flno: integer, from: string, to: string, distance: integer,
departs: time, arrives: time, price: integer)
Aircraft(aid: integer, aname: string, cruisingrange: integer)
Certified(eid: integer, aid: integer)
Employees(eid: integer, ename: string, salary: integer)

Write each of the following queries in SQL:


1. For each pilot who is certified for more than three aircraft, find the eid and
the maximum cruisingrange of the aircraft that he (or she) is certified for.
2. Find the names of pilots whose salary is less than the price of the cheapest
route from Los Angeles to Honolulu.
3. Find the names of pilots certified for some Boeing aircraft.
4. Find the aids of all aircraft that can be used on routes from Los Angeles
toChicago.

4b Explain about Stored Procedures with examples.

5a How do you create a view in SQL? Give examples. Can you update a view table?
Discuss.

5b Explain the concept of triggers with examples.

6a Explain the different types of joins with examples.

6b Write short note on group by clause with having clause.


-------------------------

MODULE-2

1a Discuss all the aggregate functions with suitable relational algebra


examples.

1b Write short notes on NULL and the 3 valued logic.

2a Consider the following schema:


EMPLOYEE(FName, Minit, LName, Ssn, Bdate, Address, Sex, Salary, super-ssn, Dno)
DEPARTMENT(Dname, Dnumber, Mgr_ssn, Mgr_st_date)
DEPART_LOCATIONS(Dnumber, Dlocation)
PROJECT(Pname, Pnumber, Plocation, Dnum)
WORKS_ON(Essn, Pno, Hours)
DEPENDENT(Essn, Dependent_name, Sex, Bdate, Relationship)
Write the relational algebra queries for the above schema:
1. Find the names of employees who work on all the projects controlled by
department number 5.
2. Retrieve the names of employees who have no dependents.
3. List the names of all employees with two or more dependents.

2b Write short notes on Cartesian product with examples.

3a Write short notes on Theta join and Natural join with examples.

3b Explain different set operators in relational algebra with examples.

4a How are the OUTER JOIN operations different from the INNER JOIN operations?

4b Differentiate between Cartesian product and Joins with examples.

5a Explain the concept of Tuple Relational Calculus with example.

5b Write short notes on division operation with examples.

6 Consider the following schema:


Branch(bname, bcity, assests)
Customer(cname, cstreet, ccity)
Account(anumber, bname, balance)
Loan(loanno, bname, amount)
depositor(cname, anumber)
borrower(cname, loanno)

Write the relational algebra queries for the above schema.

You might also like