Oracle Database Administration I — Question 132
The sales table has columns PROD_ID and QUANTITY_SOLD of data type number.
Which two queries execute successfully? (Choose two.)
Answer options
- A. SELECT COUNT(prod_id) FROM sales WHERE quantity_sold > 55000 GROUP BY prod_id;
- B. SELECT COUNT(prod_id) FROM sales GROUP BY prod_id WHERE quantity_sold > 55000;
- C. SELECT prod_id FROM sales WHERE quantity_sold > 55000 AND COUNT(*) > 10 GROUP BY COUNT(*) > 10;
- D. SELECT prod_id FROM sales WHERE quantity_sold > 55000 GROUP BY proa_id HAVING COUNT(*) > 10;
- E. SELECT prcd_id FROM sales WHERE quantity_sold > 55000 AND COUNT (*) > 10 GROUP BY prod_id HAVING COUNT(*) > 10;
Correct answer: A, D
Explanation
Query A is valid as it correctly counts PROD_ID after filtering records with QUANTITY_SOLD greater than 55000 and groups by PROD_ID. Query D fails because 'proa_id' is a misspelled column name; it should be 'prod_id'. The other queries contain syntax errors or misuse of SQL clauses, which prevents them from executing successfully.