Using the CARSHOWROOM database given in the chapter, write the SQL queries for the following: List the total number of cars having no discount.
SELECT COUNT(*) FROM INVENTORY WHERE Discount = 0;
Explanation
The question asks to count cars with no discount. From the context, question 8(b)(i) states that 'No discount is available on the LXI model', meaning the Discount column value would be 0 for such cars. Following the pattern shown in Example 9.22(a) which uses COUNT(*) with a WHERE clause, the query counts all records from the INVENTORY table where the Discount value equals 0.
Solution Steps
Step 1: Identify that we need to count records from INVENTORY table
Step 2: Apply filter condition for cars with no discount (Discount = 0)
Step 3: Use COUNT(*) aggregate function to get total number