Bird
0
0

Consider a view EmployeeSalaries created as:

medium📝 query result Q5 of 15
SQL - Views
Consider a view EmployeeSalaries created as:
CREATE VIEW EmployeeSalaries AS SELECT EmployeeID, Salary FROM Employees WHERE Salary > 50000;

If the Employees table has 100 rows with 30 employees earning more than 50000, what will SELECT COUNT(*) FROM EmployeeSalaries; return?
AAn error due to missing columns
B100
C30
D0
Step-by-Step Solution
Solution:
  1. Step 1: Understand the view filter condition

    The view includes only employees with Salary > 50000.
  2. Step 2: Count rows matching the condition

    Given 30 employees meet this condition, the count from the view is 30.
  3. Final Answer:

    30 -> Option C
  4. Quick Check:

    View row count = Filtered rows count [OK]
Quick Trick: View row count matches filtered base table rows [OK]
Common Mistakes:
MISTAKES
  • Counting all rows ignoring WHERE clause
  • Expecting error due to missing columns
  • Confusing view with full table

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes