SQL Quest › SQL Interview Questions › Querying Basics

The IN Operator

EasyFreeQuerying Basics

Find employees in the Engineering, Marketing, or Sales departments. Show name, department, position, and salary. Sort by department, then salary descending. IN is cleaner than writing multiple OR conditions.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect". Free accounts get 10 free challenge solves, and this can be one of them.

Schema

employees

emp_idnamedepartmentpositionsalaryhire_datemanager_idperformance_rating
1Alice JohnsonEngineeringSenior Developer950002019-03-1554.5
2Bob SmithEngineeringDeveloper750002020-06-0113.8
3Carol WilliamsMarketingMarketing Manager850002018-09-20NULL4.2

Expected output: Employees from 3 specific departments

Hint

WHERE department IN ('Engineering', 'Marketing', 'Sales') is equivalent to department = 'Engineering' OR department = 'Marketing' OR department = 'Sales'.

Concepts

SELECT WHERE IN

Practise the topic: SQL practice questions

Read the concept: Learn SQL for beginners

Related questions

Filter with WHEREEasy · FreeComparison OperatorsEasy · FreeMultiple Conditions (AND / OR)Easy · FreeSorting and LimitingEasy · FreeDISTINCT ValuesEasy · FreePattern Matching with LIKEEasy · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test