I am making a movie theatre management system in Python using mySQL and I need to make it so that if a datetime range is to be inserted such that it overlaps with another show that an error would be brought up.
For example, if I have a certain movie at 8PM in hall 1, and if i tried to insert another movie at the same time, an error would be brought up.
I have made a composite key between start time and hall that if there is an exact match in the newly inputed time and hall that an error is brought up. I have another column for the time when the movie ends and I would like to know how to make it possible that no other movie can be inserted between the start and end, for this certain hall.
This is the layout of the database
cur.execute(f"INSERT INTO SHOWS(movie_name, showtimings,showend, hall, price, pricevip, pricevipb, priceprem) VALUES('{movname}', '{showtimings}','{endtime}', {hall}, {price}, {pricevip}, {pricevipb}, {priceprem})")