Your question is SQL for Inventory Trends. Start with the requirements and the two 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.
Can you write a SQL query to analyze food inventory data for trends?
Use the provided food item and inventory movement data. Include completed inbound and outbound movements, while ignoring movements with an unknown category or NULL movement date.
category, month, total_received, total_consumed, net_change, movement_count, and trend.Increasing, Decreasing, or Stable based on net change.| Column | Type | Description |
|---|---|---|
| food_item_idPK | INT | Unique identifier for the food item |
| item_name | VARCHAR(100) | Name of the food item |
| category | VARCHAR(50) | Food category |
| Column | Type | Description |
|---|---|---|
| movement_idPK | INT | Unique identifier for the inventory movement |
| food_item_id | INT | Referenced food item |
| movement_date | DATE | Date when the movement occurred |
| movement_type | VARCHAR(40) | Movement direction, such as IN or OUT |
| quantity | NUMERIC(12,2) | Quantity moved |
| status | VARCHAR(30) | Processing status of the movement |