Создание веб-приложения, сочетающего в себе проектирование и создание баз данных, работу со сторонними форматами данных, программирование в NET и веб-разработку, страница 30

  CONSTRAINT `couching_ibfk_1` FOREIGN KEY (`user`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `couching_ibfk_2` FOREIGN KEY (`team`) REFERENCES `teams` (`id`),

  CONSTRAINT `couching_ibfk_3` FOREIGN KEY (`season`) REFERENCES `seasons` (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `transfers` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `season` int(11) NOT NULL,

  `team1` int(11) NOT NULL,

  `team2` int(11) NOT NULL,

  `user1` int(11) NOT NULL,

  `user2` int(11) NOT NULL,

  `players_from_t1` varchar(255) DEFAULT NULL,

  `players_from_t2` varchar(255) DEFAULT NULL,

  `money_from_t1` float DEFAULT NULL,

  `money_from_t2` float DEFAULT NULL,

  `other_from_t1` varchar(255) DEFAULT NULL,

  `other_from_t2` varchar(255) DEFAULT NULL,

  `date` datetime NOT NULL,

  PRIMARY KEY (`id`),

  KEY `team1` (`team1`),

  KEY `team2` (`team2`),

  KEY `user1` (`user1`),

  KEY `user2` (`user2`),

  KEY `foreign_season` (`season`),

  CONSTRAINT `transfers_ibfk_5` FOREIGN KEY (`season`) REFERENCES `seasons` (`id`),

  CONSTRAINT `transfers_ibfk_1` FOREIGN KEY (`team1`) REFERENCES `teams` (`id`),

  CONSTRAINT `transfers_ibfk_2` FOREIGN KEY (`team2`) REFERENCES `teams` (`id`),

  CONSTRAINT `transfers_ibfk_3` FOREIGN KEY (`user1`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `transfers_ibfk_4` FOREIGN KEY (`user2`) REFERENCES `auth_user` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `awards` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `name` varchar(255) NOT NULL,

  `note` text,

  `league` int(11) DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `league` (`league`),

  CONSTRAINT `awards_ibfk_1` FOREIGN KEY (`league`) REFERENCES `tournaments` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `reward` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `award` int(11) NOT NULL,

  `user` int(11) NOT NULL,

  `team` int(11) NOT NULL,

  `player` int(11) DEFAULT NULL,

  `rate` float DEFAULT NULL,

  `note` text,

  `season` int(11) NOT NULL,

  `date` datetime NOT NULL,

  PRIMARY KEY (`id`),

  KEY `award` (`award`),

  KEY `user` (`user`),

  KEY `team` (`team`),

  KEY `player` (`player`),

  KEY `season` (`season`),

  CONSTRAINT `reward_ibfk_1` FOREIGN KEY (`award`) REFERENCES `awards` (`id`),

  CONSTRAINT `reward_ibfk_2` FOREIGN KEY (`user`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `reward_ibfk_3` FOREIGN KEY (`team`) REFERENCES `teams` (`id`),

  CONSTRAINT `reward_ibfk_4` FOREIGN KEY (`player`) REFERENCES `players` (`id`),

  CONSTRAINT `reward_ibfk_5` FOREIGN KEY (`season`) REFERENCES `seasons` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `khl20122013_1_calendar` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `round` int(11) NOT NULL DEFAULT '0',

  `home` int(11) NOT NULL,

  `away` int(11) NOT NULL,

  `date_tab` datetime DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `home` (`home`),

  KEY `away` (`away`),

  CONSTRAINT `khl20122013_1_calendar_ibfk_1` FOREIGN KEY (`home`) REFERENCES `teams` (`id`),

  CONSTRAINT `khl20122013_1_calendar_ibfk_2` FOREIGN KEY (`away`) REFERENCES `teams` (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `khl20122013_1_goaliestats` (

  `player` int(11) NOT NULL,

  `game` int(11) NOT NULL,

  `team` int(11) NOT NULL,

  `gp` int(11) NOT NULL DEFAULT '0',

  `gs` int(11) NOT NULL,

  `w` int(11) NOT NULL,

  `w_ot` int(11) NOT NULL,

  `w_so` int(11) NOT NULL,

  `l` int(11) NOT NULL,

  `l_ot` int(11) NOT NULL,

  `l_so` int(11) NOT NULL,

  `so` int(11) NOT NULL,

  `so_sv` int(11) NOT NULL,

  `sa` int(11) NOT NULL,

  `ga` int(11) NOT NULL,

  `sho` int(11) NOT NULL,

  `g` int(11) NOT NULL,

  `a` int(11) NOT NULL,

  `pim` int(11) NOT NULL,

  `toi` float NOT NULL,

  PRIMARY KEY (`player`,`game`),

  KEY `team` (`team`),

  KEY `foreign_game` (`game`),