Write a SQL query involving a JOIN and handling missing values using IFNULL.
Asked in the Virtual Onsite stage. SQL question involving join operations and missing data handling.
Use the tables below to return each order with its customer name and a fallback region when the customer region is missing.
orders to customers on customer_id.order_id, order_date, customer_name, and region.customers.region is NULL, show 'Unknown' instead.'Unknown Customer' for the name.| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Order identifier |
| customer_id | INT | References customers.customer_id |
| order_date | DATE | Date the order was placed |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Customer identifier |
| customer_name | VARCHAR(100) | Customer name |
| region | VARCHAR(50) | Customer region, may be missing |