U23ITP33 DBMS LAB IMPORTANT QUESTIONS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Create the following tables with given attributes having appropriate data type and specify the

1.
necessary primary and foreign key constraints:
Customer (Custid, Custname, Age, phone)
Loan (Loanid, Amount, Custid, EMI)
a) List the name of the customers who have taken loan for more than Rs.50,000.
b) List the Customer id of those who have no loan.
c) List the total count of loan availed.
d) Create a procedure to print the Amount and Custid when the Loanid is given as input.
Handle Exceptions.

Create the following tables with given attributes having appropriate data type and specify the
2.
necessary primary and foreign key constraints:
Employee (EmpId, Empname, Sal, Deptno)
Dept (Deptno, Dname, Loc,DeptmanagerId)
a) List the count of Employees and average salary of each department.
b) List the employee name, department name and the salary of all the employees.
c) Display the Employee name and the respective department manager name.
d) Create a function to return the salary of the employee when Empid is given as input
parameter. Handle Exceptions.
Create the following tables with given attributes having appropriate data type and specify the
3.
necessary primary and foreign key constraints:
Voter (VoterId, Votername, Gender, Boothid,Checkvote) checkvote is 1(voted) or 0 (not
voted)
Booth (Boothid, Location,BIncharge )
a) (i)List the count of voters in each Booth (ii) List the count of Male voters voted.
b) Display the overall count of voters voted in the election.
c) Display the Boothid, Location and count of voters voted.

d) Write a function to return the percentage of poll in a booth when boothid is given as input.
Handle Exceptions.

Create the following tables with given attributes having appropriate data type and specify the
necessary primary and foreign key constraints:
4.
User (Userid, Name, Dept, Bookid, Accdate)
Book (Bookid, Book_name, Author, Publication, Price)
a) List the name of the user who had accessed the costliest book.
b) List the userid and count of books accessed by the user.
c) List the books published by Wiley publisher.
d) Write a PL/SQL program to print the details of the book when Bookid is given as input.
Handle appropriate exceptions.

Create the following tables with given attributes having appropriate data type and specify the
5.

Page 1 of 7
necessary primary and foreign key constraints:
Customer (Custid, Custname, Addr, phno,panno)
Loan (Loanid, Amount, Interest, Custid)
Account (Acctno, Accbal, Custid)
a. Display the Account balance amount of a particular customer “ARUN”
b. Update the interest with 1% when Accbal of the Custid >50% of Loan Amount
c. Create a View with Accbal and Loan Amount of all Customers
d. Create a trigger which checks for minimum balance in the account.
Create the following tables with given attributes having appropriate data type and specify the
6.
necessary primary and foreign key constraints:
Customer (Custid, Custname, phno,pan,DOB)
HomeLoan (HLoanid, Amount, Custid)
VehicleLoan (VLoanid, Amount, Custid)
a) List the Custid of the customers who have both homeloan and vehicle loan.
b) List the Custid of the customers who donot have any loan.
c) Create a view with customerid, Customer name and total loan amount (HomeLoan and
VehicleLoan)
d) Write a trigger which displays the Homeloan details whenever the values are inserted in the
respective table.

Create the following tables with given attributes having appropriate data type and specify the
7.
necessary primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Sales (Salesid, Prodid, qty)
a) Add a column reorder in Product table having value 50 for all products.
b) Create a Login form to validate a user.
c) Create a Form using Menus to
(i) Add a product.
(ii) Delete a product.
Create the following tables with given attributes having appropriate data type and specify the
8.
necessary primary and foreign key constraints:
Product (Prodid, Prodesc, Price, Stock)
Sales (Salesid, Prodid, qty)
a) Add a column reorder in Product table having value 50 for all products.
b) Display the Sales Report.
c) Create an application for
i) User Login &
ii) checking the availability of a product in a stock.
Design a Database for Library Management System using ER Diagram.
9.

Page 2 of 7
Create the following table with the given attributes having appropriate data type and specify the
necessary key constraints.
 BOOK(Bookcode,Name,Author,Price,Publish)
Design forms to
a) Login
b) Add & delete book details
Create an application for student contacts management application. The application enables a faculty
10.
user to login and search the details of a Student (Name, Address, Contact no, Email id, parent contact)
with his register number. Create necessary tables and Forms.
Create the following tables with given attributes having appropriate data type and specify the
11.
necessary primary and foreign key constraints:
Marks(Regno,Name , Dept, Subj1,Subj2,Subj3)
a) Add a column Total in student table and update the Total field with the sum of 3
subject Marks.
b) Find the second maximum total in the table.
c) Display the name of the student with maximum total.
d) Write a PL/SQL program to display the report sheet of the students using cursors.

12. Write the Query statement for the following:


a. Return the login’s user name.
b. Calculate your age using PL/SQL in built function with DOB.
c. Retrieve the word DATA from the String DATABASE.
d. Display the day of the today’s date.
e. Create a table with a field and use a sequence to insert values from 1 t0 50 into the
field.
f. Create a Student table (Regno, name, dept) and populate with data.
g. Create a view for CSE dept with the details of students of CSE dept.
h. Implement TCL commands with student table.
i. Write a PL/SQL program to find the details of the student when regno is given as
input. Handle Exceptions.

Create the following tables with the mapping given below.


13.
stu_details (reg_no, stu_name, DOB, address, city)

Page 3 of 7
mark_details (reg_no, mark1, mark2, mark3, total)
(a) Alter the table mark_details to add a column average with data type as long.
(b) Display the months between the DOB and till date.
(c) Using alter command drop the column address from the table stu_details.
(d) Write a PL/SQL program to find the sum & average marks of all the student using procedures.
Create the following tables with the mapping given below.
14.
Employee (Empno, Ename, Job, MgrId, DoB, DoJ, Sal, Comm, Deptno)
Department (Dname, Deptno, Dloc)
(a) Display the Emp no, name, salary and experience of each employee ordered by salary
(highest to lowest)
(b) List the names of the employee working for “Marketing” Department.
(c) List the names of the employees born in the current month.
(d) Write a PL/SQL function to display the details of the employee when Employee no given
as input. Handle Exceptions.
15. (a) Create a table Student (Regno, name , Mark) and insert records. Write a PL/SQL function
to print the grade of the Student. Obtain student mark as input from the main program. Check
for the following condition: if the input mark ranges 91-100 then Grade A, 81-90 then Grade
B, 71-80 then Grade C, 60-70 then Grade D and <60 Grade E.
(b) Develop an application for Banking System. Design a Database schema and create
necessary tables and forms.
16. (a) Create a table Bank (acc_no, name, balance) and insert records into the table. Write a
PL/SQL program for the Bank table to notify the user if the account balance is less than 500.
Obtain account no as input. Handle Exceptions.
(b) Develop an application for inventory management System. Design a Database schema and
Create necessary tables and forms.
17. Create a Table as workers and the details are { S.No, Name, Designation, Branch }
Perform the following commands:
 Alter the table by adding a column Salary
 Alter the table by modifying the column Name
 Describe the table employee
 Copy the table employee as emp
 Truncate the table
 Delete the Second row from the table
 Drop the table

18. Create the following tables


student_details {register_no, student_name, DOB, address, city}
mark_details {register_no, mark1, mark2, mark3, total }

Page 4 of 7
 Display only those rows whose total ranges between 250 and 300.
 Drop the table mark_details and Delete the row whose register_no=161.
 Display all details whose names begins with 'a'.
19. Consider the following relational schema for a Loan database application:
Customer {Customer_id, Customer_name, Age, phone_no}
Loan { Loan_id, Amount, Customer_id)}
 Include the constraint on Loan_id that it starts with letter ‘L’.
 Display the list of the customer_ids and total Loan amount taken.
 Display the Customer_id and Customer_name who have taken less than two loans.
20. Consider the following database for a Banking Enterprise.
Branch{branch_name, branch_city, assets) ACCOUNT(accno, branch_name, balance}
Depositor {customer_name, accno) CUSTOMER(customer_name, customer_street,
customer_city}
Loan {loan_number, branch_name, amount}
Borrower { customer_name, loan_number)}
 Create the above tables by properly specifying the primary keys and foreign keys and
enter at least five tuples for each relation.
 Find all the customers who have at least two accounts at the main branch.
 Find all the customers who have an account at all the branches located in a specific
city.
 Demonstrate how you delete all account tuples at every branch located in a specific
city.
21. Write a procedure called proc_udate is created and stored in the database. This procedure
when called in PL/SQL block updates the qty_on_hand in the product_master table it also
updates the order_status in the sales_order table.
 Prodct_master { product_no, description, profit_percentage, unit_measure,
qty_on_hand, recorder_level, sell_price, cost_price }
 Sales_order {order_no, order_date, client_no, dely_address, salesman_no, dely_type,
billed_yn, delay_date, order_status }
22. Consider the following database consisting of the following tables:
Hostel (hno, hname, type [boys/girls])
Menu (hno, day, breakfast, lunch, dinner)
Warden (wname, qual, hno)
Student (sid, sname, gender, year, hno)
 Display the total number of girls and boys hostel in the college.
 Display the menu in the hostel ‘x’ on Tuesday.
 Display the number of wardens for each hostel.II.

23. Consider a view branch_cust defined as follows:


Create view branch_cust as
select branch_name, customer_name
from depositor, account

Page 5 of 7
where depositor.account_number = account.account_number.
suppose that a view is materialized; that is the view is computed and stored. Write a trigger to
maintain the view, that is, to keep it up-to-date on insertions to and deletions from depositor
or account. Do not bother about updates.
24. Create an Employee table with an attributes { empid, empname, department designation,
Gross_salary . Using cursor, select the five highest paid employees from
the Employee table.
Consider the employee relational database, Where the primary keys are underlined.
Employee ( employee_name, street, city)
Works ( employee_name, company_name, salary)
Company ( comapny_name, city)
Manages ( employee_name, manager_name)
 Find all employees in the database who earn more than each employee of Small Bank
Corporation.
 Assume that the companies may be located in several cities. Find all companies
located in every city in which Small Bank Corporation is located.
 Give all managers of first Bank Corporation a 10 percent raise unless the salary
becomes greater than $100,000; in such cases, give only a 3 percent raise.
25. Consider the following relational schema:
Employee( empno, name, office, age )
Books ( isbn, title, authors, publisher )
Loan ( empno, isbn, date )
Write the following queries in SQL:
 Print the names of employees who have borrowed any books published by McGraw-Hill.
 Print the names of employees who have borrowed all books published by McGraw-Hill.
 For each publishers, print the names of employees who have borrowed more than five
books of that publisher.
27. Create the usage of various Data Definition Language commands like creating table, Alter table,
Drop table and Truncating Table.

28. Create the usage of various Data Manipulation Language commands like insert, delete,
update, deleting the records as well as fields of data and transaction control commands like
commit, rollback, savepoint.

29. Create the usage of join queries and nested queries(sub queries).

30. Create views , sequences and implement alter, drop command in views

31. Create the database programming for implicit cursors.

Page 6 of 7
32. Create the database programming for explicit cursors.

Create the following tables with given attributes having appropriate data type and specify the necessary
33.
primary and foreign key constraints:
Marks(Regno,Name , Dept, Subj1,Subj2,Subj3)
a) Add a column Total in student table and update the Total field with the sum of 3 subject
Marks.
b) Find the second maximum total in the table.
c) Display the name of the student with maximum total.
d) Write a PL/SQL program to display the report sheet of the students using cursors.
Create the following tables with the mapping given below.
34.
stu_details (reg_no, stu_name, DOB, address, city)
mark_details (reg_no, mark1, mark2, mark3, total)
(a) Alter the table mark_details to add a column average with data type as long.
(b) Display the months between the DOB and till date.
(c) Using alter command drop the column address from the table stu_details.
(d) Write a PL/SQL program to find the sum & average marks of all the student using procedures.
Create the following tables with the mapping given below.
35.
Employee (Empno, Ename, Job, MgrId, DoB, DoJ, Sal, Comm, Deptno)
Department (Dname, Deptno, Dloc)
(a) Display the Emp no, name, salary and experience of each employee ordered by salary (highest
to lowest)
(b) List the names of the employee working for “Marketing” Department.
(c) List the names of the employees born in the current month.
(d) Write a PL/SQL function to display the details of the employee when Employee no given as
input. Handle Exceptions.

Page 7 of 7

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy