how to create a fact table?


i have been thru bol , book "data mining sql server 2005," still don't understand fact table creation. if understand correctly, data mining cannot done without fact tables. correct? also, how 1 go creating fact table. here's example of 1 thing which trying do:

 

i have several tables contain results of different types of analysis. tables use datetime primary key (yes, datetimes unique per table). in case, 1 table contains variable predict. contains integer data pertaining current state (e.g. 0 1 state, +1 another, -4 still another, etc.). other tables each contain 1 or more variables used try predict state of (hopefully) predictable variable described in first table. alternatively, understand in what, if any, ways are the other variables associated current state of predictable variable.

 

based on that, how physically create fact table? there fact table wizard? have created manually with joins in a query? can see, @ a loss understand how fact table created.

after searching web, came across helpful tutorial on sql server data mining website:

http://www.sqlserverdatamining.com/ssdm/default.aspx?tabid=94&id=162

 

while working thru tutorial occurred me @ fact table code in adventureworksdw example of how fact table created:

 

code snippet

use [adventureworksdw]

go

/****** object: table [dbo].[factcurrencyrate] script date: 04/22/2008 17:21:17 ******/

set ansi_nulls on

go

set quoted_identifier on

go

create table [dbo].[factcurrencyrate](

[currencykey] [int] not null,

[timekey] [int] not null,

[averagerate] [float] not null,

[endofdayrate] [float] not null

) on [primary]

go

alter table [dbo].[factcurrencyrate] with check add constraint [fk_factcurrencyrate_dimcurrency] foreign key([currencykey])

references [dbo].[dimcurrency] ([currencykey])

go

alter table [dbo].[factcurrencyrate] check constraint [fk_factcurrencyrate_dimcurrency]

go

alter table [dbo].[factcurrencyrate] with check add constraint [fk_factcurrencyrate_dimtime] foreign key([timekey])

references [dbo].[dimtime] ([timekey])

go

alter table [dbo].[factcurrencyrate] check constraint [fk_factcurrencyrate_dimtime]

 

 



SQL Server  >  Data Mining



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........