Consider the following six relations for an order-processing database applicatio
ID: 3876180 • Letter: C
Question
Consider the following six relations for an order-processing database
application in a company:
CUSTOMER (Cust#, Cname, City)
ORDER (Order#, Odate, Cust#, OrdAmt)
ORDERITEM (Order#, Item#, Qty)
ITEM (Item#, Unitprice)
SHIPMENT (Order#, Warehouse#, Shipdate)
WAREHOUSE (Warehouse#, City)
Here, OrdAmt refers to total dollar amount of an order; Odate is the
date the order was placed; Shipdate is the date an order is shipped
from the warehouse. Assume that an order can be shipped from several
warehouses
Give an update operation to a database state that
violates a key constraint, stating any assumptions on the database
state you make.
Explanation / Answer
In the given database schema
lets assume the following
In the order table the ORDAmt has a constraints that it cannot be zero
So if we want to update an orderAmt (lets take the order number as 123 ) to 0 then it will violate the key constraints and it will give error.
UPDATE ORDER
SET OrdAmt=0
WHERE Order# = 123;
So this query will generate error for the update constraints.