Advertisements
Advertisements
प्रश्न
Using the CARSHOWROOM database given in the chapter, write the SQL queries for the following:
- Add a new column Discount in the INVENTORY table.
- Set appropriate discount values for all cars keeping in mind the following:
(i) No discount is available on the LXI model.
(ii) VXI model gives a 10 percent discount.
(iii) A 12 percent discount is given on cars other than the LXI model and VXI model. - Display the name of the costliest car with the fuel type “Petrol”.
- Calculate the average discount and total discount available on Baleno cars.
- List the total number of cars having no discount.
टीपा लिहा
Advertisements
उत्तर
- ALTER TABLE INVENTORY ADD Discount INT;
- (i) UPDATE INVENTORY SET Discount = 0 WHERE Model = 'LXI';
(ii) UPDATE INVENTORY SET Discount = 10 WHERE Model = 'VXI';
(iii) UPDATE INVENTORY SET Discount = 12 WHERE Model NOT IN (LXI', VXI'); - SELECT CarName, FuelType FROM INVENTORY WHERE Price = MAX(Price) and FuelType = 'Petrol';
- SELECT AVG(Discount), SUM(Discount) FROM INVENTORY WHERE CarType = 'Baleno',
- SELECT COUNT(") FROM INVENTORY WHERE Discount = 0;
shaalaa.com
SQL for Data Definition
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
