Item inventory
Question
You are given 2 tables, the first one is named current_inventory, and contains has the current inventory per item. The second table is called location_section_capacity, and contains the warehouse capacity of a given location.
The schemas of the tables are below:
current_inventory
location_id | The unique location code for the warehouse, int |
---|---|
section_id | The unique section id for the warehouse, int |
item_id | The ID of the given item in stock, int |
item_size | The size of the given item, int |
num_items | The number of items currently in inventory, int |
location_section_capacity
warehouse_state | The state that the warehouse is in, varchar |
---|---|
location_id | The unique location code for the warehouse, int |
section_id | The unique section code for section in the warehouse, int |
location_section_capacity | The capacity of the given section, int |
Using these two tables, write a SQL query to highlight location sections that have < 50% of the space occupied. To get the amount of space taken up by the item you will need to multiply item_size and num_items. Also note that if a location has no items, it might not show up in current_inventory.