intermediateDatabase438 of 469

COUNT(*) vs COUNT(1) vs COUNT(column).

Tests whether you know COUNT(*) and COUNT(1) are functionally identical (both count all rows, and most optimizers treat them the same), while COUNT(column) counts only non-NULL values in that specific column -- a subtle but important difference when the column is nullable.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Spring Boot & Microservices questions