Aggregating Inventory Movements In A CTE
#3 · 3 of 10Free sampleQuestion
Aggregating Inventory Movements In A CTE
Use a CTE to transform
inventory_movements by computing an example statistic: For instance, take the absolute value of change_quantity. Then select movement_id and your computed value from the CTE. Only show rows where movement_id <= 10.Tables11 tables · 52 columns
Tables
11 tables · 52 columnscustomers7 cols
- customer_idINTEGER
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- cityTEXT
- join_dateTEXT
- phoneTEXT
departments3 cols
- department_idINTEGER
- department_nameTEXT
- locationTEXT
employees6 cols
- employee_idINTEGER
- first_nameTEXT
- last_nameTEXT
- department_idINTEGER
- hire_dateTEXT
- salaryREAL
categories2 cols
- category_idINTEGER
- category_nameTEXT
products6 cols
- product_idINTEGER
- product_nameTEXT
- category_idINTEGER
- unit_priceREAL
- stock_quantityINTEGER
- creation_dateTEXT
orders6 cols
- order_idINTEGER
- customer_idINTEGER
- employee_idINTEGER
- order_dateTEXT
- statusTEXT
- total_amountREAL
order_items4 cols
- order_idINTEGER
- product_idINTEGER
- quantityINTEGER
- unit_priceREAL
suppliers4 cols
- supplier_idINTEGER
- supplier_nameTEXT
- cityTEXT
- products_suppliedTEXT
shipping_addresses6 cols
- shipping_idINTEGER
- order_idINTEGER
- addressTEXT
- cityTEXT
- stateTEXT
- postal_codeTEXT
inventory_movements5 cols
- movement_idINTEGER
- product_idINTEGER
- change_quantityINTEGER
- movement_dateTEXT
- reasonTEXT
cities3 cols
- city_idINTEGER
- city_nameTEXT
- stateTEXT
Loading the practice editor and dataset…
Sign up to unlock
The reference answer is one click away.
Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.
- Reference answer + explanation revealed after each attempt
- GPT tutor for every problem
- Progress saved on the platform
- 1,598 graded exercises
- Free forever — no credit card
