1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| CREATE TABLE `t_ville` (
`id_ville` SMALLINT(5) UNSIGNED NOT NULL auto_increment,
`cp` VARCHAR(5) NOT NULL,
`nom` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id_ville`),
UNIQUE KEY (`nom`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_groupe` (
`id_groupe` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(100) NOT NULL,
`tags` VARCHAR(255) NOT NULL,
`memo` TEXT NOT NULL,
PRIMARY KEY (`id_groupe`),
UNIQUE KEY (`nom`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_etablissement` (
`id_etablissement` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(100) NOT NULL,
`adresse` VARCHAR(255) NOT NULL,
`id_ville` SMALLINT(5) UNSIGNED NOT NULL,
`tel` VARCHAR(10) NOT NULL,
`fax` VARCHAR(10) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`site_internet` VARCHAR(255) NOT NULL,
`tags` VARCHAR(255) NOT NULL,
`memo` TEXT NOT NULL,
`id_groupe` SMALLINT(5) UNSIGNED,
PRIMARY KEY (`id_etablissement`),
INDEX (`nom`),
FOREIGN KEY (`id_groupe`) REFERENCES `t_groupe` (`id_groupe`) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (`id_ville`) REFERENCES `t_ville` (`id_ville`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
Partager