LPIC-1 Exam 102 (Linux Administrator) — Question 15

Which of the following SQL queries counts the number of occurrences for each value of the field order_type in the table orders?

Answer options

Correct answer: B

Explanation

The correct answer is B because it uses the GROUP BY clause to aggregate results for each distinct order_type, allowing for counting occurrences. Option A incorrectly tries to filter results rather than group them, C is syntactically incorrect for counting, D counts total orders instead of distinct order types, and E has invalid syntax and doesn't reflect the required counting operation.