Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 29 Next »

Database:

Create database holidays;

create table holiday (
  id int not null auto_increment,
  description varchar(63) not null,
  official_date datetime not null,
  observed_date datetime not null,
  primary key(id, observed_date),
  index off_idx(official_date),
  index obs_idx(observed_date)
) Engine=InnoDB;

create table type (
  id int not null auto_increment,
  description varchar(7) not null,
  primary key(id)
) Engine=InnoDB;

insert into type (description) values ("Bank");
insert into type (description) values ("Federal");
insert into type (description) values ("State");
insert into type (description) values ("UH");

create table holiday_type (
  holiday_id int not null,
  type_id int not null,
  primary key(holiday_id, type_id),
  index type_idx(type_id),
  FOREIGN KEY (holiday_id) REFERENCES holiday(id) ON DELETE CASCADE,
  FOREIGN KEY (type_id) REFERENCES type(id) ON DELETE CASCADE
) Engine=InnoDB;

  • No labels