I need to make schedule for Instructor include
day,time,date time,courses,classes(lab or class room),instructor
so that i designed my database as following
my relations as following
Instructor with courses many to many
class with instructor many to many
Relation between class and instructor many to many because
instructor can teach in more classroom and class room can have
more instructor
To make schedule for instructor i make relation between Instructor
table and Courses table many to many and generate third table
InstructorCourses table have InstructorID and CourseID
But
How to add ClassID to table InstructorCourses although Class table have relation many to many with table Instructor
day,time,date time,courses,classes(lab or class room),instructor
so that i designed my database as following
my relations as following
Instructor with courses many to many
class with instructor many to many
Relation between class and instructor many to many because
instructor can teach in more classroom and class room can have
more instructor
Code:
CREATE TABLE [dbo].[Courses](
[CourseID] [int] IDENTITY(1,1) NOT NULL,
[CourseName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_dbo.Courses] PRIMARY KEY CLUSTERED
(
[CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Class](
[ClassID] [int] IDENTITY(1,1) NOT NULL,
[ClassName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_dbo.Class] PRIMARY KEY CLUSTERED
(
[ClassID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Instructor](
[InstructorID] [int] IDENTITY(1,1) NOT NULL,
[IstructorName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_dbo.Instructor] PRIMARY KEY CLUSTERED
(
[InstructorID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[InstructorCourses](
[CourseID] [int] NOT NULL,
[InstructorID] [int] NOT NULL,
[fromtime] [nvarchar](50) NULL,
[totime] [nvarchar](50) NULL,
[day] [nvarchar](50) NULL,
CONSTRAINT [PK_dbo.InstructorCourses] PRIMARY KEY CLUSTERED
(
[CourseID] ASC,
[InstructorID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Instructor_Class](
[ClassID] [int] NOT NULL,
[InstructorID] [int] NOT NULL,
CONSTRAINT [PK_dbo.Instructor_Class] PRIMARY KEY CLUSTERED
(
[ClassID] ASC,
[InstructorID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
table and Courses table many to many and generate third table
InstructorCourses table have InstructorID and CourseID
But
How to add ClassID to table InstructorCourses although Class table have relation many to many with table Instructor