nerdexam
LPI

102-400 · Question #98

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

The correct answer is B. SELECT order_type,COUNT(*) FROM orders GROUP BY order_type. See the full explanation below for the reasoning.

Question

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

Options

  • ASELECT order_type,COUNT(*) FROM orders WHERE order_type=order_type;
  • BSELECT order_type,COUNT(*) FROM orders GROUP BY order_type;
  • CCOUNT(SELECT order_type FROM orders);
  • DSELECT COUNT(*) FROM orders ORDER BY order_type;
  • ESELECT AUTO_COUNT FROM orders COUNT order_type;

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    71% (22)
  • C
    16% (5)
  • D
    3% (1)
  • E
    6% (2)

Community Discussion

No community discussion yet for this question.

Full 102-400 Practice