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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Base de données: `mpm`
--
--
-- Structure de la table `questions`
--
CREATE TABLE IF NOT EXISTS `questions` (
`id_question` int(255) unsigned NOT NULL AUTO_INCREMENT,
`id_sondage` int(255) unsigned NOT NULL COMMENT 'id du sondage',
`label` varchar(255) NOT NULL,
`ordre` int(255) unsigned NOT NULL,
`type` varchar(255) NOT NULL,
PRIMARY KEY (`id_question`),
UNIQUE KEY `id_sondage` (`id_sondage`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
-- --------------------------------------------------------
--
-- Structure de la table `reponses`
--
CREATE TABLE IF NOT EXISTS `reponses` (
`id_reponses` int(255) unsigned NOT NULL AUTO_INCREMENT,
`id_questions` int(255) unsigned NOT NULL,
`label` varchar(255) NOT NULL,
PRIMARY KEY (`id_reponses`),
KEY `id_questions` (`id_questions`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
--
-- Structure de la table `sondages`
--
CREATE TABLE IF NOT EXISTS `sondages` (
`id_sondage` int(255) unsigned NOT NULL AUTO_INCREMENT,
`nom_sondage` varchar(80) NOT NULL,
`theme` varchar(25) NOT NULL,
`actif` tinyint(1) unsigned NOT NULL DEFAULT '0',
`date_creation` date NOT NULL,
PRIMARY KEY (`id_sondage`),
UNIQUE KEY `nom_sondage` (`nom_sondage`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Contraintes pour la table `reponses`
--
ALTER TABLE `reponses`
ADD CONSTRAINT `reponses_ibfk_1` FOREIGN KEY (`id_questions`) REFERENCES `questions` (`id_question`) ON DELETE CASCADE ON UPDATE CASCADE; |
Partager