Your question is Core SQL Query Writing. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
TE Connectivity analysts need a quarterly view of customers purchasing AMP connector products. Write a PostgreSQL query that identifies customers meeting both order-count and sales-value thresholds.
customers, orders, and order_items.product_family = 'AMP Connector'.quantity * unit_price.HAVING to keep customers with at least two qualifying orders and at least $1,000 in sales. Sort by sales descending, then customer name.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Customer identifier |
| customer_name | VARCHAR(100) | Customer name |
| region | VARCHAR(50) | Sales region |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Order identifier |
| customer_id | INT | Related customer identifier |
| order_date | DATE | Date the order was placed |
| order_status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| order_item_idPK | INT | Line-item identifier |
| order_id | INT | Related order identifier |
| product_family | VARCHAR(80) | TE Connectivity product family |
| product_name | VARCHAR(120) | Product description |
| quantity | INT | Units ordered |
| unit_price | DECIMAL(10,2) | Price per unit |