Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dbms Lab Set-Qp

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.Create the following tables with the mapping given below.

a. Student_details (reg_no, stu_name, DOB, address, city)


b. mark_details (reg_no, mark1, mark2, mark3, total)
1. Alter the table mark details to add a column average with data type as long.
2. Display the months between the DOB and till date.
3. Using alter command drop the column address from the table stu_details.
4. Write a pl/sql program to find the sum & avg marks of all the student using procedures.
5. Write a procedure named Student that accepts the regno and displays the DOB,address,city

1 .Create the following tables with the mapping given below.


a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no, salary).
b. dept_details (dept_no, dept_name, location).
1. Display the months between the doj and till date.
2. Alter the table emp_details to add a primary key constraint on emp_no.
3. Drop the table dept details.
4. Write a pl/sql program to display the salary of a particular employee using functions.
5. Design and implement library information system to insert data's in DB and update
Data’s in DB using VB/Java as front end and Ms-Access as back end

1.Create the following tables with the mapping given below.


a. stu_details (reg_no, stu_name, DOB, address, city)
b. mark_details (reg_no, mark1, mark2, mark3, total)
1. Find out the name of all students.
2. List all the student detail that who are all located in Chennai.
3. Drop the table mark_details.
4. Write a pl/sqlprogram to find the address of a particular student using functions.
5. Design Student Details from the tableusing Front end tool.

1.Create the following tables with the mapping given below.


a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no, salary).
b. dept_details (dept_no, dept_name, location).
1. Select dept_no from dept_details and not in emp_details using both the tables.
2. Create a table named as student and insert values into the table.
3. Write a pl/sql program to display the salary of a particular employee using functions.
4. Write PL/SQL Program to generate even numbers
5. Design and implement payroll system to insert data's in DB and delete Data from DB
using VB as front end and Ms-Access as back end.

1.Create the following tables with the mapping given below.


Phone_book(ph_no,name,door_no,street,place).

1. List the price of the book which one is between the price of 400 & 500.
2. Creating Trigger To Insert Values To Another Table.
3. Write a pl/sql program to find the factorial of a given number.
4. Write a pl/sql program to find the greatest of a three numbers.
5. Design and implement library Management to insert data's in DB and delete Data from DB
using VB as front end and Ms-Access as back end.

1.Create the following table with the mapping given below.


retailor(Cust_id, Cust_name, place, ph_no,pan_no).
1. Alter the table to add a column pin_no.
2. Display the details of customer who are all living in bangalore.
3. Display the customer name whose first letter is ‘M’.
4. Write a pl/sql program in procedure using in & out parameter.
5. Write a pl/sql program to find the greatest of a three numbers.

1.Create the following table with the mapping given below.


a .Product_master(product_name,purchase_prize,sell_prize,profit,quantity,balance)
b.Customer (Cust_id, Cust_name, Addr, ph_no,pan_no).
1. Display all the customer names along with their address.
2. Drop the table customer.
3. Change thesell_price to 5000&purchase_price amount to 4000 for any one of the product in
product_master.
4. Create a trigger to update the balance in product_ master table whenever transaction table will
have a new entry.
5. Design and implement library management system to insert data's in DB and update Data’s in
DB using VB/Java as front end and Ms-Access as back end.
1.Create the following table with the mapping given below.
a. stu_details (reg_no, stu_name, DOB, address, city)
b. mark_details (reg_no, mark1, mark2, mark3, total)
1. Find out the name of all students along with their total marks.
2. Change the mark1 as ‘78’ from ‘59’ and alter the total for a particular student.
3. Delete all the records and its memory space from the table student.
4. Write a pl/sql program to check whether the given number is prime or not.
5. Write a pl/sql program to find the greatest of a three numbers.

1.Create the following table with the mapping given below.


Product_master(product_name,product_no,purchase_prize,sell_prize,profit,quantity,balance)
1. Change the purchase_prize into 551 for the product_no pd3.
2. Delete all products from product_master where the Quantity is equal to 40.
3. Find the product no & product name of the product which have a purchase amount equal to
Rs.5500.
4. Write a pl/sql program to find the factorial of a given number using functions.
5. Design and implement library Management to insert data's in DB and delete Data from DB using
VB as front end and Ms-Access as back end.

1.Consider the following relations for a bus reservation system application:


a) BUS (ROUTENO, SOURCE, DESTINATION)
b) PASSENGER (PID, PNAME, DOB, GENDER)
c) BOOK_TICKET (PID, ROUTENO, JOURNEY_DATE, SEAT_NO)
1. The primary keys are underlined. Identify the foreign keys
2. Include constraint that DOB of passenger should be after 2010
3. Display the passengers who had booked the journey from Bangalore to Chennai on 03- NOV-
2014.
4. Create a view that displays the RouteNo, source, destination and journey_date which moves from
Chennai to Pune.
5. Create a PL / SQL stored procedure that accepts journey_date and displays list of passengers
booked ticket on that date.
6. In the above created procedure, include exceptions to display "No ticket booked on specified
date" for a given journey_date

1.Consider the following relations for an order processing application:


a. CUSTOMER (CID, NAME)
b. PRODUCT (PCODE, PNAME, UNIT_PRICE)
c. CUST_ORDER (OCODE, ODATE, CID)
d. ORDER_PRODUCT (OCODE, PCODE, NOU)
NOU – Number of Units. An order can contain many products.
1. The primary keys are underlined. Identify the foreign key
2. Develop a SQL query to list the details of products whose unit price is greater than the average
price of all products
3. List the customer names who have orders more number of products
4. Create a view that displays the PCODE, PNAME and NOU of the product ordered
5. Create a function that accepts PCODE, Unit_Price and NOU. Calculate the total_cost of the
ordered product. Return the total_cost.
6. Create a sequence named Product_Sequence that will get incremented by 1. Use the created
sequence while inserting PCODE into Product table.

1.Consider the following relations for a transport management system application:


a. BUS (ROUTENO, SOURCE, DESTINATION)
b. DRIVER (DID, DNAME, DOB, GENDER)
c. ASSIGN_ROUTE (DID, ROUTENO, JOURNEY_DATE)
1. The primary keys are underlined. Identify the foreign keys.
2. Include constraints that the routeNo starts with letter 'R' and gender of driver is always 'Male'
3. Create a sequence named Driver_Sequence that will get incremented by 1.
4. Use the created sequence while inserting DID into Driver table.
5. Create a view that displays the DID, DNAME assigned for RouteNo 'R5' on 02-NOV-2014
1.Consider the following relations for an order-processing database application in a company:
a. CUSTOMER (CUSTOMERNO VARCHAR2 (5), CNAME VARCHAR2 (30), CITY VARCHAR2 (30))
Implement a check constraint to check CUSTOMERNO starts with ‘C’
b. CUST_ORDER (ORDERNO VARCHAR2 (5), ODATE DATE, CUSTOMERNO REFERENCES CUSTOMER,
ORD_AMT NUMBER (8))
Implement a check constraint to check ORDERNO starts with ‘O’
c. ITEM (ITEMNO VARCHAR2 (5), ITEM_NAME VARCHAR2 (30), UNIT_PRICE NUMBER (5))
Implement a check constraint to check ITEMNO starts with ‘I’
d. ORDER_ITEM(ORDERNO REFERENCES CUST_ORDER, ITEMNO REFERENCES ITEM, QTY NUMBER
(3))
e. SHIPMENT (ORDERNO REFERENCES CUST_ORDER, ITEMNO REFERENCES ITEM, SHIP_DATE DATE)
Here, ORD_AMT refers to total amount of an order (ORD_AMT is a derived attribute); ODATE is the date the order
was placed; SHIP_DATE is the date an order is shipped.
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraint as mentioned above.
3. Create a synonym on for CUST_ORDER table
4. 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).

1.Consider the following relational schema for a library management system:


a. BOOK (BOOKID, TITLE, PUBLISHERCODE, NO_OF_COPIES) PUBLISHER (PUBLISHERCODE,
PUBLISHER_NAME) AUTHOR (AUTHORID, AUTHOR_NAME)
b. BOOK_AUTHOR (BOOKID, AUTHORID) BORROWWER (CARDNO, NAME)
c. BOOK_LOAN (BOOK_ID, CARDNO, DATEOUT, DUEDATE, STATUS)
Implement a Check Constraint for STATUS (‘R’ – Returned, ‘T’ – To be returned)
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraints as mentioned above.
3. Develop a SQL query to list the details of borrowers who do not have any books checked
out.
4. Develop a SQL query to list the details of borrowers who have more than five books checked
out.
5. 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’)
6. Create a procedure named Author_Details that accepts the BookID and displays the author
ID, author name and also the status of the book.

1.Consider the following Staff relational schema:


a. STAFF (STAFFNO, NAME, DOB, GENDER, DOJ, DESIGNATION, BASIC_PAY, DEPTNO)
GENDER must take the Value ‘M’ or ‘F’
b. DEPT (DEPTNO, NAME)
c. SKILL (SKILL_CODE, DESCRIPTION, CHARGE_OUTRATE)
d. STAFF_SKILL (STAFFNO , SKILL_CODE)
e. PROJECT (PROJECTNO, PNAME, START_DATE, END_DATE, BUDGET,
PROJECT_MANAGER_STAFFNO)
f. WORKS (STAFFNO, PROJECTNO, DATE_WORKED_ON, IN_TIME, OUT_TIME)
1. The primary keys are underlined. Identify the foreign keys and draw schema diagram
2. Include the constraints as mentioned above.
3. Develop a SQL query to list the details of staff who earn less than the basic pay of all staff.
4. Create a view that keeps track of DeptNo, DeptName and number of staff in each
department.
5. Develop a SQL query to list the details of staff who have more than three skills.
6. Develop a procedure Staff_Increment that will accept staff number and increment amount as
input and update the basic pay of the staff in the staff table.
1.Consider the following relational schema for a company database application:
a. EMPLOYEE (ENO, NAME, GENDER, DOB, DOJ, DESIGNATION, BASIC, DEPT_NO, PAN, SENO)
i. Implement a Check Constraint for GENDER
ii. PAN – Permanent account Number
iii. SENO – Supervisor Employee Number

b. DEPARTMENT (DEPT_NO, NAME, MENO)


c. PROJECT (PROJ_NO, NAME, DEPT_NO)
d. WORKSFOR (ENO, PROJ_NO, DATE_WORKED, HOURS)
1. The primary keys are underlined. Identify the foreignkeys
2. Include the constraints as mentioned above.
3. Develop a SQL query to list the details of department which has more than 3 employees
working for it.
4. Develop an SQL query to list the departments and the details of manager in each
department.
5. Create an index on EmpNo in WorksFor table
6. Develop a procedure Employee_Increment that will accept Employee number and increment
amount as input and update the basic pay of the employee in the employee table.

1.Consider the following relational schema for a Loan database application:


a. Customer (Custid, Custname, Age, phno)
b. HLoan (HLoanid, Amount, Custid)
c. VLoan (VLoanid, Amount, Custid)
Where HLoan is Housing loan and VLoan is a Vechile loan.
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraint on HLoanid that it starts with letter ‘H’ and VLoanid starts with letter ‘V’.
3. Display the number of VLoan taken by a particular customer id
4. Display the list of the customerids and total HLoan amount taken.
5. Create a view that keeps track of customer details who have taken both HLoan and VLoan
6. Create a sequence named Customer_Sequence that gets incremented by 3 and use it for inserting
Custid values in Customer table.

1.Consider the following relational schema for a Sales database application:


a. Product (Prodid, Prodesc, Price, Stock)
b. Purchase (Purid, Proid, qty, supplierName) Sales (Saleid, Proid, qty, custname)
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraint on Saleid that it starts with letter ‘S’.
3. Display the amount (price * qty) of Products in each Sales.
4. Create a view which displays Product ids and sum of quantity in sales
5. Create a Trigger which reduces the stock of Product that is been inserted in sales and print if it is
out of stock (stock <Reord)

1.Consider the following relational schema for a Loan database application:


a. Customer (Custid, Custname, Age, phno)
b. Loan (Loanid, Amount, Custid, Emi)
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraint on Custid that it starts with letter ‘C’.
3. Update the loan amount by increase in 2 % for all customers
4. Display the custid and Custname whose loan amount lies in the range of 30,000 to 50,000
5. Display the CustId and CustName who have taken less than 2 loans
6. Create a view that keeps track of Custid, Custname, loanid and loan amount.
7. Create a sequence named Customer_Sequence that gets incremented by 3 and use it for inserting
Custid values in Customer table.

1. Consider the following relational schema for Products Order database application:
a. Products (p_id, p_name, retail_price, qty_on_hand)
b. Orders (order_id, order_date)
c. Order_details (order_number, product_number, qty_ordered)
Where: order_number references order_id product_number references p_id
1. The primary keys are underlined. Identify the foreign keys
2. Include the constraint on orderid that it starts with letter ‘O’.
3. Display the ProdID and the sum of quantity ordered for each product.
4. Create a view that keeps track of P_id, price, order_id, qty_ordered and ordered_date.
5. Develop a procedure named Product_Orders that accepts a Product id or product number and
displays all the order_details of the product.
6. In the above created procedure include exception to display “No such Order Number” if incorrect
order number is given.

You might also like