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!

Key Takeaways

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

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

6-Phase SQL Roadmap 2026 | Data Analytics & Engineering | #shorts
6-Phase SQL Roadmap 2026 | Data Analytics & Engineering | #shorts
SCALER
Label and One-Hot Encoding #ai #machinelearning #datascience #datacleaning #preprocessing
Label and One-Hot Encoding #ai #machinelearning #datascience #datacleaning #preprocessing
Ascent
How The Super Bowl Uses Machine Learning 🏈 #ai #nfl #superbowl #nextgen #machinelearning
How The Super Bowl Uses Machine Learning 🏈 #ai #nfl #superbowl #nextgen #machinelearning
Ascent
Modified Distribution Method (MODI) In Transportation Problem /Operations Research/Statistics
Modified Distribution Method (MODI) In Transportation Problem /Operations Research/Statistics
EZIKAN ACADEMY
DeepCrawl Tutorials | Reporting Overview  2015
DeepCrawl Tutorials | Reporting Overview 2015
DeepCrawl
DeepCrawl | Reporting Overview
DeepCrawl | Reporting Overview
DeepCrawl