Bird
0
0

Given a view high_salary defined as:

medium📝 query result Q13 of 15
SQL - Views
Given a view high_salary defined as:
CREATE VIEW high_salary AS SELECT name, salary FROM employees WHERE salary > 70000;

What will this query return?
SELECT * FROM high_salary WHERE salary > 80000;
ASyntax error because salary filter is repeated
BAll employees with salary greater than 70000
CAll employees with salary greater than 80000
DEmpty result because salary > 70000 is overridden
Step-by-Step Solution
Solution:
  1. Step 1: Understand the view definition

    The view returns employees with salary > 70000 only.
  2. Step 2: Apply the query filter on the view

    The query further filters those results to salary > 80000, so only employees with salary above 80000 are returned.
  3. Final Answer:

    All employees with salary greater than 80000 -> Option C
  4. Quick Check:

    View filters 70000+, query filters 80000+ [OK]
Quick Trick: Filters on views stack, narrowing results [OK]
Common Mistakes:
MISTAKES
  • Thinking the second filter overrides the first
  • Assuming syntax error due to repeated conditions
  • Believing the result will be empty

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes