Which of the following SQL statements does count the rows in the 'Sales' table?

  1. SELECT COUNT(*) FROM Sales

  2. SELECT COUNT(*) IN Sales

  3. SELECT COUNTER(*) FROM Sales

  4. SELECT NUM() FROM Sales


Correct Option: A
Explanation:

To count the rows in a table, we use the COUNT() function in SQL. The correct answer is:

The Answer is: A. SELECT COUNT(*) FROM Sales

Explanation:

A. SELECT COUNT() FROM Sales: This option is correct because it uses the COUNT() function to count all the rows in the 'Sales' table. The () symbol means that we are counting all the rows.

B. SELECT COUNT(*) IN Sales: This option is incorrect because the syntax is not correct. The keyword IN cannot be used in this context.

C. SELECT COUNTER(*) FROM Sales: This option is incorrect because there is no such function as COUNTER() in SQL. The correct function name is COUNT().

D. SELECT NUM() FROM Sales: This option is incorrect because there is no such function as NUM() in SQL. We need to use the COUNT() function to count the rows in the table.

Therefore, option A is the correct answer.

Find more quizzes: