-
Notifications
You must be signed in to change notification settings - Fork 0
/
DIM_PRODUCT.sql
45 lines (45 loc) · 1.51 KB
/
DIM_PRODUCT.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
SELECT p.[ProductKey]
,p.[ProductAlternateKey]
--,[ProductSubcategoryKey]
--,[WeightUnitMeasureCode]
--,[SizeUnitMeasureCode]
,p.[EnglishProductName] as [Product Name]
,ps.EnglishProductSubcategoryName as [Sub Category]
,pc.EnglishProductCategoryName as [Category]
--,[SpanishProductName]
--,[FrenchProductName]
--,[StandardCost]
--,[FinishedGoodsFlag]
,p.[Color] AS [Color]
--,[SafetyStockLevel]
--,[ReorderPoint]
--,[ListPrice]
,p.[Size] AS [Product Size]
--,[SizeRange]
--,[Weight]
--,[DaysToManufacture]
,p.[ProductLine] AS [Product Line]
--,[DealerPrice]
--,[Class]
--,[Style]
,p.[ModelName] AS [Product Model Name]
--,[LargePhoto]
,p.[EnglishDescription] AS [Product Description]
--,[FrenchDescription]
--,[ChineseDescription]
--,[ArabicDescription]
--,[HebrewDescription]
--,[ThaiDescription]
--,[GermanDescription]
--,[JapaneseDescription]
--,[TurkishDescription]
--,[StartDate]
--,[EndDate]
,ISNULL(p.Status, 'Outdated') AS [Product Status]
FROM [AdventureWorksDW2022].[dbo].[DimProduct] as p
LEFT JOIN [AdventureWorksDW2022].[dbo].[DimProductSubcategory] AS ps
ON ps.ProductSubcategoryKey = p.ProductSubcategoryKey
LEFT JOIN [AdventureWorksDW2022].[dbo].[DimProductCategory] as pc
ON ps.ProductCategoryKey = pc.ProductCategoryKey
ORDER BY
p.ProductKey ASC