Select Employees for Role Mapping
Find employees assigned to either IT_PROG or HR_REP.
- Filtering
Exercise brief
Understand the request
Workforce planner A role-mapping review is limited to the programmer and HR representative job families.
Return employees assigned either the IT_PROG or HR_REP job code.
Return
- Return first_name, last_name, job_id in this exact left-to-right order.
Constraints
- Use a single membership predicate for both exact job codes.
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
employees
first_nameVARCHAR(50)last_nameVARCHAR(50)job_idVARCHAR(20)
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
A membership predicate is clearer than repeating the same column in multiple OR conditions.
Hint 2
Place both quoted job codes inside one parenthesized IN list.
Hint 3
SELECT first_name, last_name, job_id FROM employees WHERE job_id IN (/* approved job codes */);
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT first_name, last_name, job_id FROM employees WHERE job_id IN ('IT_PROG', 'HR_REP');Why this works
IN keeps a row when job_id equals any value in the approved list and is equivalent to two OR-connected equalities. Duplicate values in the list do not duplicate result rows, while a NULL job_id does not match the list. Inline IN lists work consistently across the supported engines; dynamic membership normally comes from a subquery or joined table.
Success check
Every returned employee has one of the two approved job codes.
Expected result
Use this output to verify values, aliases, ordering, and row count.
| first_name | last_name | job_id |
|---|---|---|
| John | Doe | IT_PROG |
| Jane | Smith | HR_REP |
| Mike | Johnson | IT_PROG |
| David | Brown | IT_PROG |
| Lisa | Davis | HR_REP |
| Amy | Taylor | IT_PROG |
| Emma | Thomas | HR_REP |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Build the next SQL skill
SELECT Statements
Select columns, filter rows, remove duplicates, and order query results.
CASE Statements & Conditional Logic
Build NULL-aware classifications, precedence-safe decisions, flags, scores, and guarded calculations with portable CASE expressions.
Date Operations & Time-Based Analytics
Practice date arithmetic, safe timestamp ranges, calendar bucketing, dense time series, rolling windows, growth, and cohort analysis.
Open the interactive workspace and practice across SQL topics.