Kennych 0 Newbie Poster

I need help making this mysql trigger. I'm creating this student enrollment project and the trigger I need needs to check that there is no course schedule conflicts when a student enrolls in course.

Everytime a student enrolls in a class a row is added to the courses database. I keep the course schedules in the schedule database.

These images should help to see how to solve this problem.

Courses db
http://76.191.104.150/courses.png
Schedule Db
http://76.191.104.150/schedule.png
Courses joined with db
http://76.191.104.150/coursesjoinwithschedule.PNG

A Class is may be taken up to three times a week which is why there is day1 day2 day3, we are trying to check before a student can enroll in a course that we check day1 day2 day3 for any conflicts. Basically I need something that check to see that the course being added into course db does not conflict with any other courses already enrolled it. So I need to do a natural join with courses and schedule then check to see if the current course id day1 day2 day3 do not have a conflict.

The day columns have a schema of MON10301230, a conflict would be if I added a course MON11301230.

I just need an idea of how to do this with triggers. Please help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.