SQL Tables used in DAX

Following are the SQL Tables Schema used in the DAX exercises.

CREATE TABLE [dbo].[DimProducts](
    [ProductID] [varchar](50) NOT NULL,
    [Name] [varchar](50) NULL,
    [Class] [varchar](50) NULL,
    [SubClass] [varchar](50) NULL,
    [Price] [float] NULL,
    [Choice] [varchar](50) NULL,
CONSTRAINT [PK_DimProducts] PRIMARY KEY CLUSTERED
(
    [ProductID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

 

CREATE TABLE [dbo].[FactSales](
    [SalesId] [varchar](50) NOT NULL,
    [Date] [date] NULL,
    [Quantity] [int] NULL,
    [Price] [float] NULL,
    [ProductID] [varchar](50) NULL,
    [WeekID] [int] NULL,
    [StoreID] [int] NULL,
CONSTRAINT [PK_FactSales] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

Relations

The one-to-many relation is shown as below.

image

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s