Explain the logical order of execution of a SQL query.
Asked in the L2 stage. Use the customers and orders tables to illustrate the explanation with a query that returns qualifying customers.
customer_name, completed_orders, and total_completed.total_completed descending, then customer_name ascending, and return at most 5 rows.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| region | VARCHAR(50) | Customer region |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer who placed the order |
| status | VARCHAR(20) | Order processing status |
| order_date | DATE | Date the order was placed |
| amount | DECIMAL(10,2) | Order amount |