I have three STUDENT, DEPARTMENT AND COURSE tables in the university database ... STUDENT has a UID as a primary key → which is a UNIQUE student ID. DEPARTMENT has Dept_id as a primary key → which is a department number of a COURSE has C_id as a primary key → which is the identifier of the course / object
I need to store labels in a table, linking the primary key of the STUDENT, DEPARTMENT and COURSE for each student in each course.
UID Dept_id C_id marks
1 CS CS01 98
1 CS CS02 96
1 ME ME01 88
1 ME ME02 90
The problem is that I create a table similar to this one for labels, then I feel that the data operator may insert the wrong combination of student primary key, for example
UID Dept_id C_id marks
1 CS CS01 98
1 CS CS02 96
1 ME CS01 88 //wrong C_id (course id) inputted by the DBA
1 ME ME02 90
In which case can I stop him from doing this? Is there also a way to keep grades for each student? I mean:
UID Dept_id CS01 CS02
1 CS 98 96
3 CS 95 92