Bird
0
0

Identify the error in this non-equi join query:

medium📝 Debug Q14 of 15
SQL - Advanced Joins
Identify the error in this non-equi join query:
SELECT e.name, s.salary_grade
FROM Employees e
JOIN SalaryGrades s ON e.salary => s.min_salary AND e.salary <= s.max_salary;
AThe join condition should use OR instead of AND.
BThe operator => is invalid; it should be >=.
CThe table alias 's' is missing in the SELECT clause.
DThe query is missing a WHERE clause.
Step-by-Step Solution
Solution:
  1. Step 1: Check operators in join condition

    The operator => is not valid SQL; the correct operator for 'greater than or equal' is >=.
  2. Step 2: Verify other parts

    AND is correct to check salary between min and max. Aliases and WHERE clause are not errors here.
  3. Final Answer:

    The operator => is invalid; it should be >=. -> Option B
  4. Quick Check:

    Use >=, not => for greater or equal [OK]
Quick Trick: Use >=, not =>, for greater or equal operator [OK]
Common Mistakes:
MISTAKES
  • Typing => instead of >=
  • Replacing AND with OR incorrectly
  • Confusing alias usage in SELECT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes