0% found this document useful (0 votes)
12 views1 page

DBMS Lab Assignment-9

The document outlines an assignment for a DBMS Lab course at Motillal Nehru National Institute of Technology Allahabad. It requires students to write SQL triggers for managing customer and order statuses in a database. Specific tasks include updating customer status, preventing orders from inactive customers, confirming orders over a certain amount, and managing order deletions based on their status.

Uploaded by

Aryan Maurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

DBMS Lab Assignment-9

The document outlines an assignment for a DBMS Lab course at Motillal Nehru National Institute of Technology Allahabad. It requires students to write SQL triggers for managing customer and order statuses in a database. Specific tasks include updating customer status, preventing orders from inactive customers, confirming orders over a certain amount, and managing order deletions based on their status.

Uploaded by

Aryan Maurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer Science and Engineering Department

Motillal Nehru National Institute of Technology Allahabad


B.Tech V Semester
DBMS Lab (CSN15401)
Assignment-9

1. Consider the tables ‘Customers’ and ‘Orders’ with the given schema and data as follows:

Table: Customers

Table: Orders

For the above scenario, write SQL queries for the following:

a) Write a trigger that automatically updates a customer’s status to 'active' whenever they place
a new order.
b) Write a trigger that prevents a new order from being inserted into the Orders table if the
customer’s status is 'inactive'.
c) Create a trigger that automatically updates the status of an order to 'confirmed' if the
‘total_amount of the order exceeds $1000.
d) Create a trigger that updates a total_orders column in the Customers table every time an
order is inserted or deleted in the Orders table.
e) Write a trigger that sets the default status of an order to 'pending' if no status is provided
during the order insertion.
f) Create a trigger that prevents the deletion of orders that have the status of 'shipped'.

You might also like