SQLSQL
#20

Non-Equi Joins for Tier Banding and Tax Brackets in SQL

Medium
Interview Question #20

Given `employees` (emp_id, name, salary) and `salary_grades` (grade, min_salary, max_salary), assign each employee to their appropriate salary grade using a non-equi join.

Input Table: employees & salary_grades
2 rows preview
emp_idsalarygrademin_salarymax_salary
145000Grade A050000
275000Grade B50001100000
Expected Output Structure2 rows
emp_idnamesalarygrade
1Sachin45000Grade A
2Shreya75000Grade B
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us