I am designing a database for a tour event. I need to write a check constraint that monitors the tour ticket sales (TicketID) and tourcapacity. it stops sell of tickets when the maximum tourcapacity is reached. how do i write the code for a tourcapacity of 20 people? I am new to MySQL so forgive my limited knowledge. Thanks
CREATE TABLE ticket(
TicketID integer not null,
TicketPrice DOUBLE(10,2) NOT NULL DEFAULT 0.0,
PurchaseDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CustomerID integer NOT NULL,
PRIMARY KEY (TicketID)
);
CREATE TABLE tour(
TourID integer not null,
StartDate date not null,
StartTime time not null,
EndTime time not null,
TicketID integer not null,
StaffID integer not null,
LocationID integer not null,
Tourcapacity interger not null,
PRIMARY KEY (TourID)
);