Using the CARSHOWROOM database given in the chapter, write the SQL queries for the following: Set appropriate discount values for all cars keeping in mind the following:
No discount is available on the LXI model.
UPDATE INVENTORY SET Discount = 0 WHERE Model = 'LXI';
VXI model gives a 10 per cent discount.
UPDATE INVENTORY SET Discount = 10 WHERE Model = 'VXI';
A 12 per cent discount is given on cars other than LXI model and VXI model.
UPDATE INVENTORY SET Discount = 12 WHERE Model NOT IN ('LXI', 'VXI');
Explanation
This question requires writing UPDATE queries to modify the Discount column in the INVENTORY table. Each sub-part specifies a different condition based on the Model column. The UPDATE statement uses the WHERE clause to filter records and SET clause to assign the appropriate discount value. For part (iii), the NOT IN operator is used to exclude both LXI and VXI models.