Practice Interview Questions
| Question | Status |
|---|---|
A company is planning to hire candidates for both junior and senior roles with a budget cap of $50,000. The hiring process prioritizes filling senior positions first, followed by junior positions.
For instance, suppose the budget is 20,000 and junior roles $10,000. In this scenario, the company can hire 2 senior candidates (as hiring 3 would exceed the budget) and 1 junior candidate to use the remaining budget after allocating funds for senior roles.
Write a SQL query to calculate how many senior and junior positions the company can fill within the given budget using the candidates table.
candidates table:
| Column Name | Description |
|---|---|
| id | Unique identifier for each candidate |
| positions | Junior or Senior position |
| salary | Expected salary of the candidate |
| Seniors | Junior |
|---|---|
| 2 | 1 |
A company is planning to hire candidates for both junior and senior roles with a budget cap of $50,000. The hiring process prioritizes filling senior positions first, followed by junior positions.
For instance, suppose the budget is 20,000 and junior roles $10,000. In this scenario, the company can hire 2 senior candidates (as hiring 3 would exceed the budget) and 1 junior candidate to use the remaining budget after allocating funds for senior roles.
Write a SQL query to calculate how many senior and junior positions the company can fill within the given budget using the candidates table.
candidates table:
| Column Name | Description |
|---|---|
| id | Unique identifier for each candidate |
| positions | Junior or Senior position |
| salary | Expected salary of the candidate |
| Seniors | Junior |
|---|---|
| 2 | 1 |