Help me finalize the script to determine the date

Hello! Excuse me, could you help me?
I have a script (only an excerpt of it is presented here) that asks the user to specify the start date of the event and the end date of the event. Then he adds them to the table, groups them by the columns “Start of the event” and “End of the event” and if the number is more than one, then deletes the record and asks the user to choose a different date. But it is not perfect, I would like the script to search in a range of dates, for example, if the user specified a date in the range 22.05.2023 11:00 - 22.05.2023 13:00, then the user should get an answer: This date range is busy, please select another date. Tell me how to implement this?
My script:

while True:
    start_date_time = input("Enter a different date and time for the start of the event (in the format DD.MM.YYYY HH:MM): ")
end_date_time = input("Enter a different date and time for the end of the event (in the format DD.MM.YYYY HH:MM): ")
row_data = {
    'Event start': start_date_time,
    'End of the event': end_date_time
    }
row = base.append_row('Applications board room', row_data)
    if base.query('SELECT `Event Start`, `Event End` FROM `Applications Board Room` GROUP BY `Event Start`, `Event End' HAVING COUNT(*) > 1'):
print('This date and time are busy, please choose another one:')
base.delete_row('Applications of the collegium hall', (row['_id']))
else:
base.query('SELECT `Event Start`, `Event End` FROM `Applications Collegium Hall` GROUP BY `Event Start`, `Event End` HAVING COUNT(*) = 1')
base.delete_row('Applications collegium hall', (row['_id']))   
        Comment = input("Briefly describe the event: ")
Support = input("Is technical support required: ")
row_data = {
        'Event start': start_date_time,
        'Organizer': ",
        'End of the event': end_date_time,
        'Describe the event': Comment,
        'Technical support': Support
        }
row = base.append_row('Applications board room', row_data)
        break