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

DBMS-Set 1 (1,5,7)

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

Department of Computer Science and Engineering

Motilal Nehru National Institute of Technology Allahabad, Prayagraj


DBMS Lab External Examination
IT V Semester
M.M:30 Time: 1 Hrs.
SET 1

Q.1 a) Create a conditional trigger that prints salary change information whenever a delete, insert or update (15 M)
statement affects the employees table—unless that information is about the President. The database
evaluates the ‘when’ condition for each affected row. If the ‘when’ condition is true for an affected
row, then the trigger fires for that row before the triggering statement runs. If the when condition is
not true for an affected row, then trigger does not fire for that row, but the triggering statement still
runs.

-----Use the below schema for the table (given in part(b)).

b) Create a log table and a trigger that inserts a row in the log table after any update statement affects the
salary column of the employees table, and then updates employees.salary and show the log table.
-------Use the below schema for the table:

Emp_Id Log_Date Old_Salary New_Salary Action Designation


201 12-Apr-2018 100000 1000000 New Salary President
202 28-Apr-2010 300000 3500000 New Salary CEO
203 12-July-2019 500000 5000000 Old Salary President

Q.2 Consider the following database for storing business related information. A customer table can be (15 M)
described with a unique customer id, customer name, annual revenue and customer type. A Shipment
table has a unique shipment id, customer id, weight (in pounds), truck id, destination and shipping date.
Each Truck table must have a unique truck id and its driver’s name. City table which consists of city
name and its population in millions(1million=1000000).
The schema of tables is as follows:

Customer (Cust_id, Cust_Name, Annual_Revenue, Cust_Type)


Shipment (Ship_id, Cust_id, Weight, Truck_id, Destination, Ship_date)
Truck (Truck_id, Driver_Name)
City ( City_Name, Population)

Write the SQL queries for the following (based on the schema that are given):-

a) List the cities that have received shipments from customers having over 4 million in annual
revenue.
b) Display the city names having population over 700 which have received a 100-pound package
from customer 101
c) List the customers who are manufacturers or have sent a package to Manali.
d) Display the customers having over $5 million in annual revenue who have sent shipments
weighing less than 1 pound or have sent a shipment to Vishakhapatnam?
e) Create a view for the Customers with annual revenue between $1 million and $2 million and
then list populations of cities along with city name which have received shipments from
customers with revenue between $1 million and $2 million?
.

*******************************

You might also like