I am developing an appointment system which has the following tables(see the attached picture). The table tblScheduleDates has some fixed dates for the appointments during the year that are entered at the beginning of the year, For example 28/02/2012,1/03/2012,4/3/2012 etc. and the tblscheduleTimes has some fixed Times for those appointments. So for example on 28/02/2012 the available times are 10:00,11:00,12:00 etc. The tblBookings is when an appointment is scheduled taking the fixed date and the fixed time and the booking status take values booked or canceled. I want to try to write a stored procedure to return the remaining Available dates and times from tblscheduledates and tblscheduleTimes. So i am thinking somehow the fixed dates and times have to be checked if they are exist in the tblbookings and if they are not to be returned by the stored procedure. Any ideas or help are welcome 
I am developing an appointment system which has the following tables(see the attached picture).
Share
Is ScheduleTime linked to ScheduleDates? The schema as far as you have it seems like you will either have A LOT of duplicate data, or just plain wrong data.
It looks like your PK/FK mapping of time to date is not displaying correctly. The link points type to time. But, the scheduletimeid is in the scheduledates?
If the values are right:
I would suggest renaming the table as it seems to really be a schedule date and time mixed together. A solution similar to my second bullet below would solve this misnaming.
If the links in the diagram are right:
Maybe I am missing something, but here is what I see:
The booking table is only tied to the scheduleddate. However, this scheduled date has a type which ties to a time. Is this so that you can have a type that is an all day schedule? Otherwise, every booking on 28/02/2012 will need to create a new entry into the SchedulDates. So, you could have 5 rows for the same date, only because they have different times? I do not see a need to store the date 5 separate times when it is really the times that are different.
Why not have the booking tie to a scheduledate AND scheduletime? This will also make your query much easier.
Or, you could have a mapping table that is scheduleddateANDtime that ties the two together, and then you only need to reference that one table in the booking?
Or, you could just store date and time together in one table?
Maybe there is a business reason that I am missing, though.