First i am creating a many to many relationship tables STUDENT and CLASSES through a table name ATTENDANCE. So a class can have many student and a student can have many class.
I have a field in CLASSES table which tell the total number of seats in the class.
I can "add attendance" to that class. But how can I limit the "add attendance" to only allow when total attendance ( # of attendance ) is less than the total number of seats of that class