0% found this document useful (0 votes)
3 views2 pages

Inventory Transactions SQL Query Analysis

This SQL query selects the transaction description, company name, branch/plant name, sum of extended cost, and count of records from the inventory fact table joined with the transaction type, branch/plant, and company dimension tables, grouping the results by transaction description, company name, and branch/plant name as well as lower levels of aggregation and ordering by those columns. The query returns 131 rows of results.

Uploaded by

Ahad Sultan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Inventory Transactions SQL Query Analysis

This SQL query selects the transaction description, company name, branch/plant name, sum of extended cost, and count of records from the inventory fact table joined with the transaction type, branch/plant, and company dimension tables, grouping the results by transaction description, company name, and branch/plant name as well as lower levels of aggregation and ordering by those columns. The query returns 131 rows of results.

Uploaded by

Ahad Sultan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 2 Assignment

Query 4: Inventory Transactions by Transaction Description, Company, and Branch


Plant

Query 4:

SELECT
TransDescription,
CompanyName,
BPName,
SUM( ExtCost ) AS COSTSUM,
Count( * ) AS INVCOUNT
FROM
Inventory_fact,
trans_type_dim,
branch_plant_dim,
company_dim
WHERE
Inventory_fact.BRANCHPLANTKEY = branch_plant_dim.BRANCHPLANTKEY
AND branch_plant_dim.COMPANYKEY = company_dim.COMPANYKEY
AND Inventory_fact.TRANSTYPEKEY = trans_type_dim.TRANSTYPEKEY
GROUP BY
GROUPING SETS (
( TransDescription, CompanyName, BPName ),
( TransDescription, CompanyName ),
TransDescription,
())
ORDER BY
TransDescription,
CompanyName,
BPName;
Result: 131 rows

You might also like