
34.8K
DADay 26 SQL | COUNT(*) vs COUNT(1) vs COUNT('x') vs COUNT(column)
Most SQL learners get this wrong 😳
SAVE this and SHARE with your Data Analyst batch 📊
📺 Follow on YouTube: Link in Bio
👉 www.youtube.com/@DataXOdyssey
❓ Confusion (Looks similar, right?)
COUNT(*)
COUNT(1)
COUNT('x')
COUNT(column)
COMPLETE QUERY (copy-paste ready):
SELECT COUNT(*) AS total_rows
FROM employees;
SELECT COUNT(1) AS total_rows
FROM employees;
SELECT COUNT('x') AS total_rows
FROM employees;
👉 You can use ANY number or ANY text
👉 Because these values are never NULL
⚠️ 4️⃣ The DIFFERENT one
SELECT COUNT(country) AS non_null_countries
FROM employees;
👉 Counts ONLY non-NULL values
👉 Rows with NULL are ignored ❌
🧠 FINAL UNDERSTANDING
• COUNT(*), COUNT(1), COUNT('x') → count rows
• COUNT(column) → counts non-NULL values only
🎯 Interview Tip:
Always use COUNT(*)
Use COUNT(column) only when excluding NULLs is intentional
📌 Part of Daily SQL Series – Day 26
🔁 Missed earlier days? Check out previous videos to learn SQL from scratch
🔁 Save this
📌 Follow for daily SQL learning
🔁 DAY SERIES FLOW
👉 Check Out Day 25: LIMIT vs Window Functions
#Day26 #DataAnalytics #SQLInterview #LearnSQL
#MySQL #PostgreSQL #DataAnalyst #TechJobsIndia
#DataXOdyssey #ReelItFeelIt #SQLBeginners
#Coding #Programming #DataScience#DataEngineer #TechCareers
@dataxodyssey










