Practice Interview Questions
| Question | Status |
|---|---|
Write a query to find matching hosts and guests pairs in a way that they are both of the same gender and nationality. Output the host id and the guest id of matched pairs.
airbnb_hosts table:
| Column Name | Description |
|---|---|
| host_id | Unique identifier for each host |
| nationality | Nationality of the host |
| gender | Gender of the host |
| age | Age of the host |
airbnb_guests table:
Write a query to find matching hosts and guests pairs in a way that they are both of the same gender and nationality. Output the host id and the guest id of matched pairs.
airbnb_hosts table:
| Column Name | Description |
|---|---|
| host_id | Unique identifier for each host |
| nationality | Nationality of the host |
| gender | Gender of the host |
| age | Age of the host |
airbnb_guests table:
| Description |
|---|
| guest_id | Unique identifier for each guest |
| nationality | Nationality of the guest |
| gender | Gender of the guest |
| age | Age of the guest |
| host_id | guest_id |
|---|---|
| 1 | 4 |
| 1 | 5 |
| 2 | 3 |
| Description |
|---|
| guest_id | Unique identifier for each guest |
| nationality | Nationality of the guest |
| gender | Gender of the guest |
| age | Age of the guest |
| host_id | guest_id |
|---|---|
| 1 | 4 |
| 1 | 5 |
| 2 | 3 |