Step 1: Understanding the Question:
The question asks to arrange five SQL clause fragments (A, B, C, D, E) in the correct syntactic sequence to construct a valid SQL query.
Step 2: Constructing the Target Query:
Let us formulate the target query based on the requirement:
- We want to select the Customer Id (CustID) and the count of cars purchased (COUNT(*)). This is represented by:
SELECT CustID (Fragment E) followed by , COUNT(*) (Fragment B).
- Next, we specify the source table:
FROM SALE (Fragment D).
- Next, we group the data by customer identifier:
GROUP BY CustID (Fragment A).
- Finally, we filter the groups to only include customers who bought more than 1 car:
HAVING COUNT(*) > 1 (Fragment C).
Step 3: Finding the Order of Fragments:
- Placing the fragments together in sequence:
1. E: SELECT CustID
2. B: COUNT(*)
3. D: FROM SALE
4. A: GROUP BY CustID
5. C: HAVING COUNT(*) > 1
- This creates the sequence: E, B, D, A, C.
- This matches option (D).
Step 4: Final Answer:
The correct syntactic sequence of writing the query is E, B, D, A, C.
Hence, option (D) is the correct choice.