Multiple choice technology databases

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

  1. SELECT COLUMNS() FROM Persons

  2. SELECT COUNT(*) FROM Persons

  3. SELECT COUNT() FROM Persons

  4. SELECT COLUMNS(*) FROM Persons

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

To count records in SQL, use the COUNT(*) aggregate function. Option B shows the correct syntax. COUNT() without asterisk (option C) is incomplete, and SELECT COLUMNS() is not valid for counting records.