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 35 36
| CREATE TABLE `t_membre` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(100) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`fullnews` TINYINT(1) UNSIGNED NOT NULL DEFAULT TRUE,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `t_membre` VALUES
(1, 'AAA', 'aaa@aaa.fr', FALSE),
(2, 'BBB', 'bbb@bbb.fr', FALSE),
(3, 'CCC', 'ccc@ccc.fr', FALSE,
(4, 'DDD', 'ddd@ddd.fr', TRUE);
CREATE TABLE `t_inscription` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`membre_id` INT UNSIGNED NOT NULL,
`etablissement_id` TINYINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`membre_id`) REFERENCES `t_membre` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (`etablissement_id`) REFERENCES `t_etablissement` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `t_inscription` VALUES
(1, 1, 1),
(2, 1, 5),
(3, 1, 6),
(4, 1, 10),
(5, 2, 1),
(6, 2, 2),
(7, 2, 3),
(8, 2, 4),
(9, 3, 2),
(10, 3, 9); |
Partager