Hi, there are what I have done. can you check over for me if it's wrong?
//Create dimensional tables
create table [dbo].[Dim_Course](
[CrsCode] [char](8) not null,
[CrsName] [nvarchar](50) not null,
[Descr] [nvarchar](200)
Constraint [PK_Dim_Course] primary key
(
[CrsCode]
)
)
create table [dbo].[Dim_Dept](
[DeptId] [char](4) not null,
[Name] [nvarchar](50) not null,
[FacultyName] [nvarchar](50) not null
Constraint [PK_Dim_Dept] primary key clustered
(
[DeptId]
)
)
Create table [dbo].[Dim_Professor](
[Id] [char](6) not null,
[Name][nvarchar](50) not null,
[Address] [nvarchar](50) not null,
[Status] [bit] not null
Constraint [PK_Dim_Professor] primary key clustered
(
[Id]
)
)
Create table [dbo].[Dim_Semester](
[Data_key] [int] not null,
[Semester] [nvarchar](20) not null,
[Year][int] not null
Constraint [PK_Dim_Semester] primary key
(
[Data_key]
)
)
//Create Fact_Table
Create table [dbo].[Fact_Table](
[DeptId] [char](4) not null,
[CrsCode] [char](8) not null,
[Id] [char](6) not null,
[Data_key] [int] not null,
[Enrollment][int] not null
Constraint [PK_Fact_Table] primary key
(
[DeptId],
[CrsCode],
[Id],
[Data_key]
)
foreign key ([DeptId]) references Dim_Dept([DeptId]),
foreign key (CrsCode) references Dim_Course(CrsCode),
foreign key (Id) references Dim_Professor(Id),
foreign key (Data_key) references Dim_Semester(Data_key)
)
I'm a little bit confused about the address attribute in the Dim_Professor. Normally, for dimensional table, every attribute has to be organized as a hierarchy. So, it would be:
Number > Street > City> Province (territory) > Country. However, if I organize it like that, how can I insert data into that table from a relational database in which the address attribute is just address?