Sobes.tech
Junior

Mis vahe on COUNT(*) ja COUNT(sütun_nimi)?

sobes.tech AI

Vastus AI-lt

COUNT(*) counts all rows in the table, including those where all field values are NULL.

COUNT(column_name) counts only the rows where the specified column_name value is not NULL.

Example:

SELECT COUNT(*) FROM my_table; -- Returns the total number of rows

SELECT COUNT(some_column) FROM my_table; -- Returns the number of rows where some_column is not NULL