I have three tables like SCHOOL, ORIENTATION and SUBJECTS.
The tables have the following attributes
CREATE TABLE [dbo].[SCHOOL](
[ID_chool] [int] IDENTITY(1,1) NOT NULL,
[SchoolName] [nvarchar](50) NOT NULL,
[AcademicYear] [nvarchar](15) NOT NULL,
[Address] [nvarchar](50) NOT NULL,
[ID_Person] [int] NOT NULL,
[ID_Municipality] [int] NOT NULL,
CONSTRAINT [PK_SCHOOL] PRIMARY KEY CLUSTERED
CREATE TABLE [dbo].[ORIENTATION](
[ID_Orientation] [int] IDENTITY(1,1) NOT NULL,
[ID_School] [int] NOT NULL,
[OrientationName] [nvarchar](50) NULL,
CONSTRAINT [PK_ORIENTATION] PRIMARY KEY CLUSTERED
And the third table
CREATE TABLE [dbo].[SUBJECT](
[ID_Subject] [int] IDENTITY(1,1) NOT NULL,
[SubjectName] [nvarchar](50) NOT NULL,
[ID_Orientation] [int] NOT NULL,
CONSTRAINT [PK_SUBJECT] PRIMARY KEY CLUSTERED
The problem is that the primary schools don't have ORIENTATIONS, so they don't need an OrientationName, only the secondary schools need an OrientationName.
How to solve this problem so I can register the subjects for primary schools.
P.S. My project has 15 tables, but I'm stuck in this problem and can't solve this problem by myself.
Thank you in advance for your reply.
Cheers.