Professional Documents
Culture Documents
MARKS: 100
(25)
(35)
c. Develop a SQL query to list the details of passengers who have traveled more
than three times on the same route.
(10)
(20)
********
MARKS: 100
2. Consider the following relations for a boat management application for a beach
resort:
SAILOR (SID, NAME, DOB, GENDER)
BOAT (BID, BTYPE, BNAME, COLOR)
BTYPE can take two values (D, S)
D Deluxe
S Super Deluxe
SAILS (SID, BID, DOT, SHIFT)
DOT Date of Trip
SHIFT can take two values FN or AN
A sailor is assigned a boat on a day. A sailor is permitted to sail the boat for only
one shift on a day. The primary keys are underlined. Identify the foreign keys.
a. Implement the above schema enforcing primary key and foreign key
constraints.
(25)
(35)
c. Develop a SQL query to list the details of boats whose type is Super Deluxe
and Color is Red.
(10)
(20)
********
B.E / B.Tech DEGREE EXAMINATIONS, APRIL / MAY 2013
R-2008
COMPUTER SCIENCE AND ENGINEERING / INFORMATION
TECHNOLOGY
FOURTH SEMESTER
CS2258: DATABASE MANAGEMENT SYSTEMS LAB
TIME: 3 HOURS
MARKS: 100
(25)
(35)
c. Develop a SQL query to list the details of products whose unit price is greater
than the average price of all products.
(10)
(20)
********
MARKS: 100
(25)
(35)
c. Develop a SQL query to list the details of drivers who have traveled more than
three times on the same route.
(10)
(20)
MARKS: 100
(25)
(35)
c. Develop a SQL query to list the details of each driver and the number of trips
traveled.
(10)
(20)
********
B.E / B.Tech DEGREE EXAMINATIONS, APRIL / MAY 2013
R-2008
COMPUTER SCIENCE AND ENGINEERING / INFORMATION
TECHNOLOGY
FOURTH SEMESTER
CS2258: DATABASE MANAGEMENT SYSTEMS LAB
TIME: 3 HOURS
MARKS: 100
(25)
(35)
c. Develop a SQL query to list the details of branches where the number of
accounts is less than the average number of accounts in all branches.
(10)
d. Develop a Report that will display the following information:
BCODE BNAME NUMBER OF ACCOUNTS
e. Viva- Voce 10 marks
********
(20)
MARKS: 100
(ORDERNO
VARCHAR2
(5),
ODATE
DATE,
(ITEMNO
VARCHAR2
(5),
ITEM_NAME
VARCHAR2
(30),
(ORDERNO
REFERENCES
CUST_ORDER,
ITEMNO
(ORDERNO
REFERENCES
CUST_ORDER,
ITEMNO
(25)
(10)
c. Develop a SQL query to list the details of customers who have placed
more than three orders.
(5)
d. Develop a SQL query to list the details of items whose price is less than
the average price of all items.
(5)
e. Develop a SQL query to list the order number and number of items in each
order.
(5)
f. Develop a SQL query to list the details of items that are present in 25% of
the orders.
(5)
(10)
h. Create a view that will keep track of the details of each customer and the
number of orders placed.
(10)
i. Develop a database trigger that will not permit to insert more than six
records in the CUST_ORDER relation for a particular order. (An order
can contain a maximum of six items).
j. Viva- voce 10 Marks
********
(15)
MARKS: 100
(20)
(10)
c. Develop a SQL query to list the details of customers who have balance less
than the average balance of all customers.
(5)
d. Develop a SQL query to list the details of customers who have performed
three transactions on a day.
(5)
e. Create a view that will keep track of customer details and the number of
accounts each customer has.
(10)
f. Develop a database trigger that will not permit a customer to perform more
than three transactions on a day.
(15)
g. Develop a database procedure that will accept transaction id, account number,
transaction type, transaction date and transaction amount as input and insert a
record into TRANSACTION table subject to the following conditions:
i. If TTYPE =D the value of BALANCE in the ACCOUNT table must
be incremented by the value of TAMOUNT
(10)
********
(15)
MARKS: 100
(20)
(10)
c. Develop a SQL query to list the details of customers who have a savings
account and a current account.
(5)
d. Develop a SQL query to list the details of branches and the number of
accounts in each branch.
(5)
e. Develop a SQL query to list the details of branches where the number of
accounts is less than the average number of accounts in all branches.
(5)
f. Develop a SQL query to list the details of customers who have performed
three transactions on a day.
(5)
g. Develop a database trigger that will not permit a customer to perform more
than three transactions on a day.
(15)
(10)
********
(15)
MARKS: 100
10. Consider the following relational schema for a library management system:
BOOK (BOOKID, TITLE, PUBLISHERCODE, NO_OF_COPIES)
PUBLISHER (PUBLISHERCODE, PUBLISHER_NAME)
AUTHOR (AUTHORID, AUTHOR_NAME)
BOOK_AUTHOR (BOOKID, AUTHORID)
BORROWWER (CARDNO, NAME)
BOOK_LOAN (BOOK_ID, CARDNO, DATEOUT, DUEDATE, STATUS)
Implement a Check Constraint for STATUS (R Returned, T To be
returned)
a. Develop DDL to implement the above Schema specifying appropriate data
types for each attribute enforcing primary key, check constraint and foreign
key constraints.
b. Populate the database with a rich data set.
(25)
(10)
c. Develop a SQL query to list the details of authors who have authored more
than three books.
(5)
d. Develop a SQL query to list the details of borrowers who do not have any
books checked out.
(5)
e. Develop a SQL query to list the details of borrowers who have more than
five books checked out.
(5)
f. Create a view that will keep track of the card number, card holders name
and number of books borrowed (Number of books with status T).
(10)
g. Develop a database trigger that will not permit a borrower to borrow a book
if there are eight books borrowed by the borrower with status T (A
borrower can borrow a maximum of eight books).
(15)
h. Develop a database trigger that will not permit a borrower to borrow a book
which he / she have borrowed and the status of the book is T.
i. Viva- voce 10 Marks
******
(15)
MARKS: 100
11. Consider the following relations for a boat management application for a beach
resort:
SAILOR (SID, NAME, DOB, GENDER, RATING)
RATING can take the vales (FAIR,GOOD,EXCELLENT)
BOAT (BID, BTYPE, BNAME, COLOR)
BTYPE can take two values (D, S)
D Deluxe
S Super Deluxe
SAILS (SID, BID, DOT, SHIFT)
DOT Date of Trip
SHIFT can take two values FN or AN
A sailor is assigned a boat on a day. A sailor is permitted to sail the boat for only
one shift on a day. The primary keys are underlined. Identify the foreign keys.
a. Develop DDL to implement the above Schema specifying appropriate data
types for each attribute and enforcing primary key, check constraint and
foreign key constraints.
b. Populate the database with a rich data set.
(30)
(10)
c. Develop a SQL query to list the details of boats whose type is Super Deluxe
and Color is Red.
(5)
d. Develop a SQL query to list the details of sailors who have sailed on the
same boat more than four times.
(5)
e. Develop a view that will keep track of sailor id, sailor name, date of trip,
boat id, boat type, boat name and shift.
(10)
f. Develop a database trigger that will not permit a sailor to sail a boat of type
S if his / her rating is FAIR.
(15)
g. Develop a database trigger that will not permit a sailor to sail for more than
one shift on a day.
(15)
MARKS: 100
12. Consider the following relational schema for a library management system:
BOOK (BOOKID, TITLE, PUBLISHERCODE, NO_OF_COPIES)
PUBLISHER (PUBLISHERCODE, PUBLISHER_NAME)
AUTHOR (AUTHORID, AUTHOR_NAME)
BOOK_AUTHOR (BOOKID, AUTHORID)
BORROWWER (CARDNO, NAME)
BOOK_LOAN (BOOK_ID, CARDNO, DATEOUT, DUEDATE, STATUS)
Implement a Check Constraint for STATUS (R Returned, T To be
returned)
a. Develop DDL to implement the above Schema specifying appropriate data
types for each attribute enforcing primary key and foreign key constraints.
(25)
b. Develop forms for inserting records in the above relations.
(35)
c. Develop an SQL query to list the details of authors who have authored more
than three books.
(5)
d. Create a view that will keep track of the card number, card holders name and
number of books borrowed.
(5)
e. Develop a database trigger that will not permit a borrower to borrow a book if
there are three books borrowed by the borrower with status T (A borrower
can borrow a maximum of five books).
(10)
(10)
PUBLISHER
PUBLISHER
NO OF
CODE
NAME
COPIES
******
MARKS: 100
(PROJECTNO,
PNAME,
START_DATE,
END_DATE,
BUDGET, PROJECT_MANAGER_STAFFNO)
WORKS (STAFFNO, PROJECTNO, DATE_WORKED_ON, IN_TIME,
OUT_TIME)
The Primary Keys are underlined.
a. Develop DDL to implement the above Schema specifying appropriate data
types for each attribute and enforcing primary key, check constraint and
foreign key constraints.
b. Populate the database with a rich data set.
(25)
(10)
c. Develop a SQL query to list the department number and number of staff in
each department.
(5)
d. Develop a SQL query to list the details of staff who earn less than the
average basic pay of all staff.
(5)
e. Develop a SQL query to list the details of departments which has more than
five staff working in it.
(5)
f. Develop a SQL query to list the details of staff who have more than three
skills.
(5)
g. Create a view that will keep track of the department number, the department
name, the number of employees in the department, and the total basic pay
expenditure for each department.
(10)
h. Develop a database trigger that will not permit a staff to work on more than
three projects on a day.
(15)
i. Develop a procedure INCR that will accept staff number and increment
amount as input and update the basic pay of the staff in the staff table.
Include exception in the procedure that will display a message Staff has
basic pay null if the basic pay of the staff is null and display a message No
such staff number if the staff number does not exist in the staff table.
j. Viva- Voce 10 marks
******
(15)
MARKS: 100
14. Consider the following relational schema for a company database application:
EMPLOYEE (ENO, NAME, GENDER, DOB, DOJ, DESIGNATION,
BASIC, DEPT_NO, PAN, SENO)
Implement a Check Constraint for GENDER
PAN Permanent account Number
SENO Supervisor Employee Number
DEPARTMENT (DEPT_NO, NAME, MENO)
MENO - Manager Employee Number
PROJECT (PROJ_NO, NAME, DEPT_NO)
WORKSFOR (ENO, PROJ_NO, DATE_WORKED, HOURS)
Each department has a manager managing it. There are also supervisors in
each department who supervise a set of employees. A department can
control any number of projects. But only one department can control a
project. An employee can work on any number of distinct projects on a
given day. The primary keys are underlined.
a.
b.
c.
(5)
d.
(25)
(5)
(5)
e.
Develop a SQL query to list the details of employees who earn less
than the average basic pay of all employees.
f.
g.
(5)
(5)
h.
i.
(10)
(15)
j.
(15)
*****