I am new to mySql and phpmyadmin, I have two tables: the college_building
table; this table has the following attributes: id
, name
, number_of_classes
. Then the second table is the classes table; this table has id
(auto-incremented) and room_number
as attributes, and also the building id as a foreign key.
Is there a way to set a limit for the number of entries in the second table using the auto-incremented id based on the number_of_classes
?
For example, if i have a building that has 20 class rooms, I want the classes table to have a maximum of 20 rows.