COUNT(column) vs COUNT(*) in SQL — With INNER, LEFT, RIGHT & FULL JOIN Explained

📰 Dev.to · Tim Nguyen

Learn the difference between COUNT(column) and COUNT(*) in SQL when using INNER, LEFT, RIGHT, and FULL JOIN to avoid common bugs

intermediate Published 24 Feb 2026
Action Steps
  1. Use COUNT(column) to count non-NULL values in a specific column
  2. Use COUNT(*) to count all rows in a result set, including NULL values
  3. Apply INNER JOIN to count matching rows between two tables
  4. Apply LEFT JOIN to count all rows from the left table and matching rows from the right table
  5. Apply RIGHT JOIN and FULL JOIN to understand how COUNT(column) and COUNT(*) behave with different join types
Who Needs to Know This

Database administrators, data analysts, and backend developers can benefit from understanding the nuances of COUNT(column) and COUNT(*) in SQL joins to write more accurate queries

Key Insight

💡 COUNT(column) only counts non-NULL values, while COUNT(*) counts all rows, including NULL values

Share This
📊 COUNT(column) vs COUNT(*) in SQL: know the difference to avoid bugs in your joins!

Full Article

Counting seems simple in SQL… until joins enter the picture. One of the most common bugs...
Read full article → ← Back to Reads

Related Videos

Salesforce Tableau CRM & Einstein Discovery Consultant Exam: Full Syllabus Breakdown (New 2025 Bluep
Salesforce Tableau CRM & Einstein Discovery Consultant Exam: Full Syllabus Breakdown (New 2025 Bluep
Emily Unfiltered
How to Hire Top SEO Talent
How to Hire Top SEO Talent
Menerva Digital
The $300,000,000,000 Company Nobody Can Explain!
The $300,000,000,000 Company Nobody Can Explain!
PlivoAI
Google Analytics Alternative For WordPress | AnalyticsWP Tutorial
Google Analytics Alternative For WordPress | AnalyticsWP Tutorial
Matt Tutorials
Modular DS Complete Guide | Step-by-Step Setup Tutorial
Modular DS Complete Guide | Step-by-Step Setup Tutorial
Matt Tutorials
What's New at CFI | Advanced SQL for Data Analysts
What's New at CFI | Advanced SQL for Data Analysts
Corporate Finance Institute