Your company stores VIP customers and standard customers in separate tables.
Write a SQL query that returns all unique emails from both tables,
sorted alphabetically.
Tables
vip_customers: id, emailstandard_customers: id, email
| vip | |
|---|---|
| 1 | alice@example.com |
| 2 | bob@example.com |
| 3 | carol@example.com |
| standard | |
|---|---|
| 1 | dave@example.com |
| 2 | alice@example.com |
| 3 | eve@example.com |
Expected output (column: email) — alice appears once despite being in both tables.
alice@example.com
bob@example.com
carol@example.com
dave@example.com
eve@example.com
UNIONremoves duplicates. UseUNION ALLto keep them.
Sample tests