The COUNT function in SQL counts how many rows match a condition. It scans each row in the table, checks if it meets the condition, and if yes, adds one to the count. For example, counting employees in the Sales department scans all employees, includes only those with department='Sales', and returns the total count. Rows not matching the condition are skipped and do not increase the count. COUNT(*) counts all rows regardless of NULLs. This visual trace shows step-by-step how rows are checked and counted, helping beginners understand how COUNT works internally.