R
rn5a
An Access DB table has the following columns:
CID - int
DateAvail - date/time
StartTime - date/time
EndTime - date/time
Seats - int
What I want is something like:
I want the table to be designed in such a way so that there can be
multiple same date records under the DateAvail column but the
corresponding StartTime & EndTime values shouldn't be multiple. For
e.g. the following records under the DateAvail, StartTime & EndTime
columns are permissible (dates are in mm/dd/yyyy format):
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 9:00:00 AM 11:00:00 AM
05/15/2007 11:00:00 AM 1:00:00 PM
No duplicate StartTime & EndTime values on 15th May but the following
shouldn't be permissible:
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 7:00:00 AM 10:00:00 AM
05/15/2007 7:00:00 AM 11:00:00 PM
since 7:00:00 AM under the StartTime column repeats for 15th May 2007
but if the date under DateAvail column is different, then duplicate
values should be allowed under the StartTime & EndTime columns. For
e.g.the following records are permissible:
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 9:00:00 AM 11:00:00 AM
05/15/2007 11:00:00 AM 1:00:00 PM
05/17/2007 7:00:00 AM 9:00:00 AM
05/17/2007 9:00:00 AM 11:00:00 AM
05/17/2007 11:00:00 AM 1:00:00 PM
(left the blank space to distinguish between 15th May & 17th May
easily). The above records are permissible because though there are
duplicate StartTime & EndTime values, the DateAvail values
corresponding to the StartTiime & EndTime values are different..
So how do I design the DB table to ensure that there aren't duplicate
values under the StartTime & EndTime columns if the corresponding
DateAvail dates are the same but if the DateAvail dates corresponding
to the StartTime & EndTime values are different, then the DB table
should allow duplicates under the StartTime & EndTime columns?
In other words, the period between 7:00:00 AM to 9:00:00 AM occurs
only once each day; hence 7:00:00 AM under the StartTime column &
9:00:00 AM under the EndTime column should not be duplicated for the
same date (say, 15th May) in the DateAvail column but each day has a
period between 7:00:00 AM to 9:00:00 AM. So if the dates under the
DateAvail column are different, then StartTime & EndTime values can be
duplicated.
CID - int
DateAvail - date/time
StartTime - date/time
EndTime - date/time
Seats - int
What I want is something like:
I want the table to be designed in such a way so that there can be
multiple same date records under the DateAvail column but the
corresponding StartTime & EndTime values shouldn't be multiple. For
e.g. the following records under the DateAvail, StartTime & EndTime
columns are permissible (dates are in mm/dd/yyyy format):
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 9:00:00 AM 11:00:00 AM
05/15/2007 11:00:00 AM 1:00:00 PM
No duplicate StartTime & EndTime values on 15th May but the following
shouldn't be permissible:
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 7:00:00 AM 10:00:00 AM
05/15/2007 7:00:00 AM 11:00:00 PM
since 7:00:00 AM under the StartTime column repeats for 15th May 2007
but if the date under DateAvail column is different, then duplicate
values should be allowed under the StartTime & EndTime columns. For
e.g.the following records are permissible:
DateAvail StartTime EndTime
05/15/2007 7:00:00 AM 9:00:00 AM
05/15/2007 9:00:00 AM 11:00:00 AM
05/15/2007 11:00:00 AM 1:00:00 PM
05/17/2007 7:00:00 AM 9:00:00 AM
05/17/2007 9:00:00 AM 11:00:00 AM
05/17/2007 11:00:00 AM 1:00:00 PM
(left the blank space to distinguish between 15th May & 17th May
easily). The above records are permissible because though there are
duplicate StartTime & EndTime values, the DateAvail values
corresponding to the StartTiime & EndTime values are different..
So how do I design the DB table to ensure that there aren't duplicate
values under the StartTime & EndTime columns if the corresponding
DateAvail dates are the same but if the DateAvail dates corresponding
to the StartTime & EndTime values are different, then the DB table
should allow duplicates under the StartTime & EndTime columns?
In other words, the period between 7:00:00 AM to 9:00:00 AM occurs
only once each day; hence 7:00:00 AM under the StartTime column &
9:00:00 AM under the EndTime column should not be duplicated for the
same date (say, 15th May) in the DateAvail column but each day has a
period between 7:00:00 AM to 9:00:00 AM. So if the dates under the
DateAvail column are different, then StartTime & EndTime values can be
duplicated.