Jump to content

Check, Trigger


TotalWhat

Recommended Posts

Hey!

 

So I have a database that handles students, courses and registration.

 

I have a table called Assignments which has three values "courseCode", "assignmentName" and "points".

I have a table called Students that has the value "pnr".

I have a table called Courses that has the value "courseCode".

I have a table called Studies that has the values "courseCode", "pnr" and "assignmentName".

I have a table called HasStudied that has the values "courseCode, "pnr, "assignmentName" and "grade".

 

Now I need a check, constraint or trigger of some type that will prevent the administrator from being able to register a student to too many courses. A student can read 45points of courses as maximum.

 

How would I go about this?

 

Thank you!

Link to comment
Share on other sites

This is as far as I have come:

 

create trigger CourseEnrollmentTriggeron Studiesinstead of insertasbeginselect sum(assignmentPoints) as Points from Assignment a join Studies son a.courseCode = s.courseCode and a.assignmentName = s.assignmentName and a.sectionName = s.sectionName and pnr = '851326'if < 45end go

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...