You are on page 1of 3

B. P. Poddar Institute of Management & Technology 137, V. I. P.

Road, Kolkata 700052 (MCA 493)


Assignment# 1 i) Write a PL/SQL program to print all the prime numbers between 100 and 400.

ii) Write a PL/SQL program to print n terms of fibonacci series. Assignment# 2 i) ii)

Write a PL/SQL block of code for inverting a number 5639 to 9365.


Write a PL/SQL program to calculate HCF of two numbers.

Assignment# 3 i) Write a program to check a string is palindrome or not. ( Use substr() function , substr(x,n1,n2) returns substring of length n2 , starting from position n1 of existing string x) ii) Use table Parts, create table Order(Clientno,partsid,qty,date), Rebate (amt,prcentg).Insert data into tables. Now create a Bill which will contain the amount to be paid by each customer. The bill table should show the total amount to be paid by each client daywise.The table should show two amount considering 2% additional rebate on cash purchase. Assignment# 4 Create the following database of an organization (Let ABC Corp.) : Employee: Eid Ename Street City Dob Dept Salary Bran Bran: Reference Branch(Branch_nm) Eid : Starts with E. (40 entries) Project: Pid Loc Pdesc Mng Client Bran Mng: Reference Employee(Eid) Bran: Reference Branch(Branch_nm) Pid: Starts with P (8 entries) Works: Pid Eid Pid: Reference Project(Pid) Eid: Reference Employee(Eid) (>= no of employee) Branch: Branch_nm City Brmng Brmng: Reference Employee(Eid) (5 entries) Supplier: Sname Sid Tel Addr City Sid strats with S (8 entries) Parts: Partno Desc Unitprice Partno starts with Pt (8 entries) Supplied_parts: Sid Partno Prjno Qty Date Sid : Reference Supplier(sid) Partno : Reference Parts(Partno) Prjno : Reference Project(Pid) (enter when required) You may change attribute name as per your choice. Create table in such a way so that constraints can be applied.

S. Mallick

DBMS Lab

B. P. Poddar Institute of Management & Technology 137, V. I. P. Road, Kolkata 700052


Assignment# 5 Write SQL to satisfy the following requirements: i) ii) iii) iv) v) vi) vii) viii) ix) x) Find the branch name that has most employees. Find part no of the parts that are supplied by a supplier of Kolkata. Find all employees who earn more than the avg salary of org. Display each employee name with branch manager name. Find all employees who earn more than the avg salary of their branch. Find the name of employees who live in the same city as their branch manager. Retrieve project no where more than one supplier has supplied. Show all supplier/part/project combination where project and supplier are situated at same city. Find supplier project pairs so that each pair indicate that the supplier and project located at different city. Find full details of the parts supplied by supplier in Kolkata.

Assignment# 6 Write SQL to satisfy the following requirements: i) ii) iii) iv) v) vi) vii) viii) ix) x) Find supplier no/part no pair such that the indicated supplier does not supply the indicated parts. Select employee of Kolkata branch in descending order of their age. Find supplier name who has supplied any parts at least one project where supplierB has supplied any parts. Find part no of the parts supplied by a supplier in Kolkata to a Project in Kolkata. Get all pairs of city names such that supplier of the first city supplies a project in the second city. Get part no for the parts supplied to any project by a supplier of the same city as project . Find project numbers for projects supplied by at least one supplier not in the same city. Find all pair of parts such that some supplier supplies both the parts. Find part nos of the parts supplied to some project in an avg quantity more than 100. Find part no & qty supplied to all Kolkata project for each part.

Assignment# 7 Write SQL to satisfy the following requirements: i) ii) iii) iv) v) vi) vii) viii) ix) x) Find all cities where at least one supplier or project is located. Find total no of project supplied by supplier S1. Find project names where supplier S1 supplies some parts. Find supplier no who supplies at least one project controlled by branch1. Find the employees who earn max of its branch. Find project nos for project supplied with part p1 in a quantity greater than the max quantity in which any part is supplied to project Prj1. Get project no whose city is first in the alphabetical order. Find supplier who supplies some part in all project. Find the name of employees who works in all projects as employee Ram works. Find the name of the employee who works for more than 10 years.

Assignment# 8 i) Write a PL/SQL program which will consider STUD(roll,secondary,hs,graduation,mca) table and insert roll no in another table STUD_STATUS(roll,status). If a student have 60% throughout have status Allowed, Otherwise if graduation percentage is more than 50 and MCA more than 75 is Allowed otherwise Not Allowed.

S. Mallick

DBMS Lab

B. P. Poddar Institute of Management & Technology 137, V. I. P. Road, Kolkata 700052


ii) Write a stored procedure in ORACLE which will take a emp name from user then show a appropriate message (i) NOT AVAILABLE for not existence of that name otherwise show the eid (take care if more than one emp have same name). Assignment# 9 i) Write a function in ORACLE to compute total net salary from a table EMP_SAL(eid,basic,da,hra,ptax.pf) which will take eid as parameter. Write a PL/SQL block which insert each eid in another table EMP_BONUS(eid,net_sal,bonus) where bonus is 30% if net salary less than 8000, bonus is 2000 if net salary between 8000 and 10000,otherwise bonus nil.

iii) write a function, which returns True if employee not exist in emplyee table otherwise it returns False. Employee(eno, ename, salary, mgrno).
Assignment# 10 i)Write a trigger which will store all deleted item of EMP into another table BACKUP_EMP which contain all attribute of EMP along with two additional attribute sysdate and status(D in this case).

ii)Write a trigger which will store old values of updated rows of EMP into another table BACKUP_EMP which contain all attribute of EMP along with two additional attribute sysdate and status(U in this case). iii) Consider tables of a library BOOK_MASTER(accn_no, bk_category, bk_name, author_name, yr_of_pub), BOOK_INFO (bk_category, total, available) , ISSUE(rollno, accn_no, issue_date). Write triggers that total and available attributes of BOOK_INFO will be updated automatically.

Assignment# 11 Consider tables of a library BOOK_MASTER(accn_no, bk_category, bk_name, author_name, yr_of_pub), BOOK_INFO (bk_category, total, available) , ISSUE(rollno, accn_no, issue_date). Write necessary PL/SQL code to return a book, which will update available of BOOK_INFO if the book is returned with in 15 days other wise display amount of fine considering Re. 1 per day.

Assignment# 12 i)Consider tables of a library BOOK_MASTER(accn_no, bk_category, bk_name, author_name, yr_of_pub), BOOK_INFO ( bk_category, total, available) , ISSUE(rollno, accn_no, issue_date). Write necessary PL/SQL code to return a book, which will update available of BOOK_INFO automatically and display the book names currently issued by that member. ii)Write a PL/SQL program to enter data in table DB_USER(usr_name,password) which will reverse the half of the password and insert. Specify the search strategy. Write necessary functions or procedures.

S. Mallick

DBMS Lab

You might also like