DBMS QP Set3 To Students
DBMS QP Set3 To Students
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 }
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.
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.
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.
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. .
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.
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 and 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.
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.
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.
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.