1

hi so have 3 tables 1 that takes in students information one that has a list of programs a student can do and finally one that now assigns each student to a different program. From this scenario a student can do a max of 2 programs and a program can only have a max of 40 students. How do I now implement these constraints to the third table?

Here is a sample of what I tried to do:

create table Student(
ID int primary key NOT NULL,
Firstname varchar (50),
Age int,
Gender varchar (6)
);



create table Program(
    ProgID number Primary Key  NOT NULL,
    ProgName varchar(50)  NOT NULL unique
);

Create table Allocation (
    StudID number  NOT NULL Check count()<=2,
    ProgID number  NOT NULL Check count()<=40,
    foreign key (StudID) references Student,
    foreign key (ProgID) references Program
);

0 Answers0