Explain key database concepts you rely on when writing and optimizing SQL queries.
Use the provided customer and order tables to demonstrate these concepts in one query. Return every customer, including customers without qualifying orders, and apply the date and status criteria without excluding unmatched customers.
customer_id, customer_name, completed_order_count, completed_revenue, and revenue_bandcompleted_revenue descending, then customer_name ascending| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| segment | VARCHAR(30) | Customer market segment |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer associated with the order |
| order_date | DATE | Date the order was placed |
| order_status | VARCHAR(20) | Order lifecycle status |
| order_amount | DECIMAL(12,2) | Order revenue amount |