Question 29 of 32advanced🔧 ApplyShort Answer2 marks

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:

(i)

No discount is available on the LXI model.

Answer

UPDATE INVENTORY SET Discount = 0 WHERE Model = 'LXI';

(ii)

VXI model gives a 10 per cent discount.

Answer

UPDATE INVENTORY SET Discount = 10 WHERE Model = 'VXI';

(iii)

A 12 per cent discount is given on cars other than LXI model and VXI model.

Answer

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.