Computer Science, asked by vivekgupta2174, 1 month ago

SQL command to find out number of rows​

Answers

Answered by Equestriadash
11

The command to display the number of rows in a table is COUNT().

It follows a similar syntax:

  • SELECT COUNT(*) FROM <table_name> WHERE <condition>;

The asterisk represents the column names of the table. If you want to know the count of a specific column, mention the column name in place of the asterisk.

If a row has a NULL value, it will not be counted. So suppose we want to know the count of a column named 'Location' from a table named 'Employee', that has the data of 6 employees, where the location of only 4 employees are stored, and the rest 2 are given as 'NULL', SELECT COUNT(LOCATION) FROM Employee; would return 4 and not 6.

Similar questions