Sunteți pe pagina 1din 2

M S RAMAIAH INSTITUTE OF TECHNOLOGY(Autonomous Institute, affiliated to VTU)

Department of Information Science & Engineering


LAB TEST
Term: 17th Jan – 14th May 2011 Sub: Database Management Systems
Subject Code: IS404
Credits: 4:0)1 Semester: IV Section: B
Course: B.E. Max. Marks: 10 Date: 11th May 2011
Instructions to Candidates: 1.MOBILE PH0NES ARE BANNED
2.Assume necessary data
SQL
1.Create following table
Branch(BranchNo,city,postcode)
Staff(staffNo,name,salary,position,branchno)
Property_Rent(Property_no, staffno, branchno)

Specify primary key and foreign key for the above schema.

Solve the following queries.


1. List the addresses of all branch offices in London or Glasgow.
2. List all the managers and supervisor using IN operator.
3. List the names of all the staff their branch office is in London.
4. Alter any one of the table by adding suitable column with the constraint.

2.Create the following tables


Sailors(sid,sname,age)
Boats(bid,bname,color)
Reserves(sid,bid,day)
Specify primary key and foreign key for the above schema.
1.Find the names and ages of all sailors
2.Find the names of sailors who have reserved boat number 103.
3.Find the colors of boats reserved by Lubber
4.Demonstrate Group by clause
3.Create the following tables
Members(Mid,Name,Dseig,Age)
Books(Bid,BTitle,BAuthor,BPrice)
Reserves(Mid,Bid,Date)
Specify the primary key and foreign key for the above schema
1. Find the names of members who are professors and over 40 years.
2. List the titles of the books reserved by Asst.prof
3. Find the author and title of books reserved on 23-Feb-2003
4. Demonstrate Order by clause
4.Create the following tables.
Works(Pname,Cname,Salary)
Lives(Pname,Street,City)
LocatedIn(Cname,City)
Specify the primary key and foreign key for the above schema
1.Find the names of the persons who work for the company ‘IBM’
2.Find the names of persons working for ‘HP’ along with the cities they live in.
3.Find the names of the persons who live and work in the same city
4.Demonstrate any three aggregate functions
5. Create the following tables.
Student(StNo,StdName)
Projects(ProjectNo,ProjectArea)
AssignedTo(StdNo,ProjectNo)
Specify the primary key and foreign key for the above schema
1.List the project no which is assigned to studentnumber ‘IS003’ and ‘IS020’
2.Find the StdNo anf student name of all those students who are working on both database
projects.
3.Find student number and student name of all those students who are working on both th
projects having project numbers p-75 and p-81
4.Demonstrate UPDATE command
PL\SQL
1. Create a program that accepts two numbers from substitution variables, display one of the following
messages:-
first is greater than second
first is less than second
first is the same as second
2. Create a program that accepts a single number. Display the Message Hello World X times, where X
is the number entered.
3. Try running the above program and entering a negative number, what happens? Change the code to
print a message if a number less than 1 is entered that informs the user they

4. Write a program that gives all employees in department 10 a 15% pay increase. Display a message
displaying how many employees were awarded the increase.
2. Create a PL/SQL block that accepts a new job title and an old job title. Find all employees in the old
job and give them the new job. Ensure a valid message is given back to the user even if no employees
changed job.

5. Create a program that accepts two numbers. If the first is larger than the second raise an exception
called e_bigger and display an appropriate message.

6.Create a program that mimics selecting all columns and rows from the dept table. There is no need to
format the output, just select all columns and all rows. Use a cursor FOR loop.
2. Create a program that copies all departments to a table called old_dept. Do not
use a cursor FOR loop. Display how many rows were copied.

S-ar putea să vă placă și