JenovaProject wrote:
Is there a way to build a table so that no team can play two games on the same date
Add either unique constraint or unique index on those columns (single constraint with two fields). Just make sure that the time portion in the date is the same. Something like:
ALTER TABLE XYZ ADD CONSTRAINT UK_SingleGame UNIQUE (date, home_id);
Then if you want you can create a similar constraint for date and away_id.
The need to optimize rises from a bad design. My articles[^]
modified on Saturday, November 8, 2008 2:58 AM