Bird
0
0

Given a table employees with 5 rows where the phone column has 2 NULL values, what will SELECT COUNT(phone) FROM employees; return?

medium📝 query result Q4 of 15
SQL - Aggregate Functions
Given a table employees with 5 rows where the phone column has 2 NULL values, what will SELECT COUNT(phone) FROM employees; return?
A3
B5
C2
D0
Step-by-Step Solution
Solution:
  1. Step 1: Understand COUNT(phone) behavior

    COUNT(phone) counts only rows where phone is NOT NULL.
  2. Step 2: Calculate count with NULLs

    There are 5 rows total, 2 have NULL phone, so count is 5 - 2 = 3.
  3. Final Answer:

    3 -> Option A
  4. Quick Check:

    COUNT(column) excludes NULLs = 3 [OK]
Quick Trick: COUNT(column) excludes NULLs, so subtract NULL count [OK]
Common Mistakes:
MISTAKES
  • Counting NULL values as well
  • Confusing COUNT(*) with COUNT(column)
  • Assuming COUNT(column) counts all rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes