I am new to SQL and I am trying to design a database in relation to a vehicle leasing company. At the moment I am trying to check if a vehicle is available for renting (i.e. has it been rented out already). I have two different tables one for bookings where the dates of the vehicle being rented is being stored and then one for where all my vehicles are being stored. I think I currently got them to connect but can't seem to get the dates to work for me so I must have something wrong. I will also include a picture of the tables so you can see where I am getting the field names from. Any help is much appreciated.
SELECT *
FROM Vehicles
WHERE Vehicles.vehicle_id NOT IN (
SELECT Booking.[vehicle id]
FROM Booking
WHERE (
[Enter Start Date] BETWEEN booking.start_rent_date
AND booking.end_rent_date
)
OR (
[Enter End Date] BETWEEN booking.start_rent_date
AND booking.end_rent_date
)
);