Search ⌘K
Airbnb
Airbnb

Foundations Track · Easy · 15 min

10. What's the SQL command INTERSECT do, and when would you use it

The SQL command INTERSECT merges the results of multiple SELECT statements and keeps only those rows that are present in all sets. For example, say you were ...

Foundations Track
Easy
15 min
filtering

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

Objective

Practice filtering through a Airbnb-tagged business scenario.

Approach

Use this track to lock in clean query structure, basic filtering logic, and confidence with grouped output.

Company context

Company labels are directional practice context, not official interview guidance.

Prereq: query basics

The SQL command INTERSECT merges the results of multiple SELECT statements and keeps only those rows that are present in all sets. For example, say you were doing an HR Analytics project for Airbnb, and had access to Airbnb's employees and contractors data. Assume that some employees were previously contractors, and vice versa, and thus would show up in both tables. You could use INTERSECT operator to find all contractors who also show up in the employees table: SELECT first_name, last_name FROM airbnb_contractors INTERSECT SELECT first_name, last_name FROM airbnb_employees ---

airbnb_contractors
contractor_id SERIAL PRIMARY KEY
first_name VARCHAR(50
airbnb_employees
employee_id SERIAL PRIMARY KEY
first_name VARCHAR(50
Editor
SQL workspace

Run queries against the protected question data, then submit once the result shape looks right.

Sign in to run SQL

Create a free account or sign in before running queries against protected question data.