Multiple choice technology databases

With SQL, how can you return the number of records in the "Persons" table?

  1. SELECT COUNT(*) FROM Persons

  2. SELECT COLUMNS(*) FROM Persons

  3. SELECT COLUMNS() FROM Persons

  4. SELECT COUNT() FROM Persons

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

COUNT() is an aggregate function that returns the total number of rows in a table. The asterisk () indicates count all rows regardless of NULL values. Options B, C, and D use incorrect syntax (COLUMNS is not a valid SQL keyword, and COUNT() requires the * parameter).