Database Reference
In-Depth Information
TASK 2: CREATING FEDER ATED AND NONFEDER ATED TABLES
In this task, you will create a federated table, CLASS, with the FEDERATED ON property.
You will also create several nonfederated tables COURSE, TIMEBLOCK, SEMESTER,
and DAYS. hese tables will be placed across all of the federation members. he following
are the steps to create these tables:
1. On the Federation Administration page, click the icon
→
next to the
Class_Federation
link under the title Federation.
2. As shown in Figure 8.31, click the cell labeled
LOW
to open a context menu.
3. In the context menu, select
Query
and then click
Create Federated Table
to open the
Query editor.
4. In the Query editor, enter the following SQL code and click the
Run
button on the
ribbon:
CREATE TABLE COURSE
(
CourseID CHAR(8) PRIMARY KEY,
CourseName VARCHAR(30)
)
GO
CREATE TABLE DAYS
(
DayID INT PRIMARY KEY,
WeekDay VARCHAR(30)
)
GO
CREATE TABLE SEMESTER
(
SemesterID INT PRIMARY KEY,
Semester VARCHAR(30)
)
GO
CREATE TABLE TIMEBLOCK
(
TimeID INT PRIMARY KEY,
TimeBlock VARCHAR(30)
)
GO
CREATE TABLE CLASS
(
ClassID BIGINT PRIMARY KEY,
CourseID CHAR(8),
Credit INT,
TimeID INT,
SemesterID INT,
DayID INT,
CONSTRAINT Class_TimeId_fk FOREIGN KEY (TimeId)
REFERENCES TIMEBLOCK (TimeId),
CONSTRAINT Class_CourseId_fk FOREIGN KEY (CourseId)