DBMS Lab Questions
DBMS Lab Questions
DBMS Lab Questions
Aim/Principle/ Calculation
Tabulation/Circuit/
Q.No Apparatus & VivaVoce Record Total
Program/Drawing
required/Procedure Results
1 5 25 10
10 10 100
2 5 25 10
LIST OF PROGRAMS
1. 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
2. Create the following tables
student_details {register_no, student_name, DOB, address, city}
mark_details {register_no, mark1, mark2, mark3, total }
● 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'.
5. 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 }
9. The accounts table is modified according to instructions stored in the action table. Each row in the
action table contains an account number, an action to be taken (I, U, or D for insert, update, or delete),
an amount by which to update the account, and a time tag used to sequence the transactions.
On an insert, if the account already exists, an update is done instead. On an update, if the account does
not exist, it is created by an insert. On a delete, if the row does not exist, no action is taken.
10. Suppose you have a table named data_table that holds data collected from laboratory experiments,
and you want to analyze the data from experiment 1.Compute the results and store them in a database
table named temp.
11. Write a program in PL/SQL to create a cursor displays the name and salary of each employee in the
Employees table whose salary is less than that specified by a passed-in parameter value.
12. Given Student_Report Database, in which student marks assessment is recorded. In such schema,
create a trigger so that the total and average of specified marks is automatically inserted whenever a
record is insert.
13. Write a PL/SQL function to calculate the income tax for the given employee:
Conditions:
If pay 2,50,000, no tax is charged.
If pay is 2,50,001 and 5,00,000, 5% of pay is charged as tax.
If pay is 5,00,001 and 10,00,000, 20% of pay is charged as tax.
If pay is 10,00,001, 30% of pay is charged as tax. .
14. Design a database for an Airline. The database must keep track of customers and their reservations,
flights and their status, seat assignments on individual flights, and the schedule and routing of future
flights.
Your design should include an E-R diagram, a set of relational schemas, and a list of constraints,
including primary-key and foreign-key constraints.
15. Consider a database used to record the marks that students get in different exams of different
courses offerings.
● Construct an ER diagram that models exams as entites, and uses a ternary relationship, for the
database.
● Construct an alternative ER diagram that uses only a binary relationship between students and
course_offerings. Make sure that only one relationship exists between a particular student and
course offering pair, yet you can represent the marks that a student gets in different exams of a
course offering.
16. 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.
19. An Electricity Board charges the following rates to domestic users to discourage large consumption
of energy:
For the first 1 - 200 units { 1 - 100 units = Rs. 1.00, 101 - 200 units = Rs.1.50 }
From 201 - 500 units{ 1 - 200 units = Rs. 2.00 and 201 - 500 units = Rs. 3.00 }
Above 500 units{ 1 - 200 = Rs. 3.50, 201- 500 unit = Rs. 4.60 &above 500 unit Rs.6.60}
Write a PL/SQL program to read the connection_id of users and number of units consumed, display the
charges with names.
20. Create a table salesman{ salesman_id, name, city, commission } and customer{customer_id, name,
city, grade, slaesman_id}. Write the following query:
● Create a view for those salesmen belongs to the city New York
● Create a view for all salesmen with columns salesman_id, name, and city
● Find the salesmen of the city New York who achieved the commission more than 13%.
● Create a view to getting a count of how many customers we have at each level of a grade.