-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Jeu 07 Janvier 2016 à 16:23
-- Version du serveur: 5.5.46-0ubuntu0.14.04.2
-- Version de PHP: 5.5.9-1ubuntu4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de données: `sid2`
--

-- --------------------------------------------------------

--
-- Structure de la table `appartenance`
--

CREATE TABLE IF NOT EXISTS `appartenance` (
  `id_appartenance` int(11) NOT NULL AUTO_INCREMENT,
  `id_etudiant` varchar(50) NOT NULL,
  `id_groupe` int(11) NOT NULL,
  `id_semestre` int(11) NOT NULL,
  `mention` varchar(3) DEFAULT NULL,
  PRIMARY KEY (`id_appartenance`),
  KEY `id_etudiant` (`id_etudiant`),
  KEY `id_groupe` (`id_groupe`),
  KEY `id_semestre` (`id_semestre`),
  KEY `identifiant` (`id_etudiant`),
  KEY `id_etudiant_2` (`id_etudiant`),
  KEY `id_groupe_2` (`id_groupe`),
  KEY `id_semestre_2` (`id_semestre`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3865 ;

--
-- RELATIONS POUR LA TABLE `appartenance`:
--   `id_etudiant`
--       `utilisateur` -> `identifiant`
--   `id_groupe`
--       `groupe` -> `id_groupe`
--   `id_semestre`
--       `semestre` -> `id_semestre`
--

-- --------------------------------------------------------

--
-- Structure de la table `controle`
--

CREATE TABLE IF NOT EXISTS `controle` (
  `id_controle` int(11) NOT NULL AUTO_INCREMENT,
  `id_mcc_module` int(11) NOT NULL,
  `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `libelle` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `base` int(11) NOT NULL,
  `coefficient` float NOT NULL,
  `publication` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_controle`),
  KEY `id_mcc_module` (`id_mcc_module`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1039 ;

--
-- RELATIONS POUR LA TABLE `controle`:
--   `id_mcc_module`
--       `mcc_module` -> `id_mcc_module`
--

-- --------------------------------------------------------

--
-- Structure de la table `enseignement`
--

CREATE TABLE IF NOT EXISTS `enseignement` (
  `id_enseignement` int(11) NOT NULL AUTO_INCREMENT,
  `id_enseignant` varchar(50) NOT NULL,
  `id_mcc_module` int(11) NOT NULL,
  `id_groupe` int(11) NOT NULL,
  `correcteur` tinyint(4) NOT NULL,
  PRIMARY KEY (`id_enseignement`),
  KEY `id_enseignant` (`id_enseignant`),
  KEY `id_mcc_module` (`id_mcc_module`),
  KEY `id_groupe` (`id_groupe`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=224 ;

--
-- RELATIONS POUR LA TABLE `enseignement`:
--   `id_enseignant`
--       `utilisateur` -> `identifiant`
--   `id_groupe`
--       `groupe` -> `id_groupe`
--   `id_mcc_module`
--       `mcc_module` -> `id_mcc_module`
--

-- --------------------------------------------------------

--
-- Structure de la table `formation`
--

CREATE TABLE IF NOT EXISTS `formation` (
  `id_formation` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `nom` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `nb_semestres` int(11) NOT NULL DEFAULT '2',
  PRIMARY KEY (`id_formation`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=82 ;

-- --------------------------------------------------------

--
-- Structure de la table `groupe`
--

CREATE TABLE IF NOT EXISTS `groupe` (
  `id_groupe` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id_groupe`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=157 ;

--
-- Contenu de la table `groupe`
--

INSERT INTO `groupe` (`id_groupe`, `nom`) VALUES
(1, 'S1A'),
(2, 'S2A'),
(3, 'S3A'),
(4, 'S4A'),
(5, 'S1B'),
(6, 'S2B'),
(7, 'S3B'),
(8, 'S4B'),
(9, 'S1C'),
(10, 'S2C'),
(11, 'S3C'),
(12, 'S4C'),
(13, 'S1D'),
(14, 'S2D'),
(15, 'S3D'),
(16, 'S4D'),
(17, 'S1E'),
(18, 'S2E'),
(19, 'S3E'),
(20, 'S4E'),
(21, 'S1F'),
(22, 'S2F'),
(23, 'S3F'),
(24, 'S4F'),
(34, 'INGBD1 S1'),
(35, 'INSIQ1 S1'),
(36, 'ITINAS S1'),
(37, 'ITINN1 S1'),
(38, 'ITINN2 S1'),
(39, 'ITINS1 S1'),
(40, 'ITINT2 S1'),
(41, 'ITINT3 S1'),
(42, 'S1M'),
(43, 'S2M'),
(44, 'S3M'),
(45, 'S4M'),
(46, 'S5M'),
(47, 'S6M'),
(48, 'S7M'),
(49, 'S8M'),
(50, 'S9M'),
(51, 'S10M'),
(52, 'S1G'),
(53, 'S1H'),
(54, 'S1I'),
(55, 'S1J'),
(56, 'S1K'),
(57, 'S1L'),
(58, 'S2G'),
(59, 'S2H'),
(60, 'S2I'),
(61, 'S2J'),
(62, 'S2K'),
(63, 'S2L'),
(64, 'S3G'),
(65, 'S3H'),
(66, 'S3I'),
(67, 'S3J'),
(68, 'S3K'),
(69, 'S3L'),
(70, 'S4G'),
(71, 'S4H'),
(72, 'S4I'),
(73, 'S4J'),
(74, 'S4K'),
(75, 'S4L'),
(76, 'S5A'),
(77, 'S5B'),
(78, 'S5C'),
(79, 'S5D'),
(80, 'S5E'),
(81, 'S5F'),
(82, 'S5G'),
(83, 'S5H'),
(84, 'S5I'),
(85, 'S5J'),
(86, 'S5K'),
(87, 'S5L'),
(88, 'S6A'),
(89, 'S6B'),
(90, 'S6C'),
(91, 'S6D'),
(92, 'S6E'),
(93, 'S6F'),
(94, 'S6G'),
(95, 'S6H'),
(96, 'S6I'),
(97, 'S6J'),
(98, 'S6K'),
(99, 'S6L'),
(100, 'S7A'),
(101, 'S7B'),
(102, 'S7C'),
(103, 'S7D'),
(104, 'S7E'),
(105, 'S7F'),
(106, 'S7G'),
(107, 'S7H'),
(108, 'S7I'),
(109, 'S7J'),
(110, 'S7K'),
(111, 'S7L'),
(112, 'S8A'),
(113, 'S8B'),
(114, 'S8C'),
(115, 'S8D'),
(116, 'S8E'),
(117, 'S8F'),
(118, 'S8G'),
(119, 'S8H'),
(120, 'S8I'),
(121, 'S8J'),
(122, 'S8K'),
(123, 'S8L'),
(124, 'S9A'),
(125, 'S9B'),
(126, 'S9C'),
(127, 'S9D'),
(128, 'S9E'),
(129, 'S9F'),
(130, 'S9G'),
(131, 'S9H'),
(132, 'S9I'),
(133, 'S9J'),
(134, 'S9K'),
(135, 'S9L'),
(136, 'S10A'),
(137, 'S10B'),
(138, 'S10C'),
(139, 'S10D'),
(140, 'S10E'),
(141, 'S10F'),
(142, 'S10G'),
(143, 'S10H'),
(144, 'S10I'),
(145, 'S10J'),
(146, 'S10K'),
(147, 'S10L'),
(148, 'INGBD1 S2'),
(149, 'INSIQ1 S2'),
(150, 'ITINAS S2'),
(151, 'ITINN1 S2'),
(152, 'ITINN2 S2'),
(153, 'ITINS1 S2'),
(154, 'ITINT2 S2'),
(155, 'ITINT3 S2'),
(156, 'ITINN1 S0');

-- --------------------------------------------------------

--
-- Structure de la table `mcc_module`
--

CREATE TABLE IF NOT EXISTS `mcc_module` (
  `id_mcc_module` int(11) NOT NULL AUTO_INCREMENT,
  `id_mcc_ue` int(11) NOT NULL,
  `id_module` int(11) NOT NULL,
  `coefficient` float NOT NULL,
  PRIMARY KEY (`id_mcc_module`),
  KEY `id_mcc_ue` (`id_mcc_ue`),
  KEY `id_module` (`id_module`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=482 ;

--
-- RELATIONS POUR LA TABLE `mcc_module`:
--   `id_mcc_ue`
--       `mcc_ue` -> `id_mcc_ue`
--   `id_module`
--       `module` -> `id_module`
--

-- --------------------------------------------------------

--
-- Structure de la table `mcc_ue`
--

CREATE TABLE IF NOT EXISTS `mcc_ue` (
  `id_mcc_ue` int(11) NOT NULL AUTO_INCREMENT,
  `id_semestre` int(11) NOT NULL,
  `id_ue` int(11) NOT NULL,
  `coefficient` float NOT NULL,
  PRIMARY KEY (`id_mcc_ue`),
  KEY `id_semestre` (`id_semestre`),
  KEY `id_ue` (`id_ue`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=75 ;

--
-- RELATIONS POUR LA TABLE `mcc_ue`:
--   `id_semestre`
--       `semestre` -> `id_semestre`
--   `id_ue`
--       `ue` -> `id_ue`
--

-- --------------------------------------------------------

--
-- Structure de la table `module`
--

CREATE TABLE IF NOT EXISTS `module` (
  `id_module` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `libelle` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id_module`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=183 ;

-- --------------------------------------------------------

--
-- Structure de la table `note`
--

CREATE TABLE IF NOT EXISTS `note` (
  `id_note` int(11) NOT NULL AUTO_INCREMENT,
  `id_appartenance` int(11) NOT NULL,
  `id_controle` int(11) NOT NULL,
  `valeur` float NOT NULL,
  PRIMARY KEY (`id_note`),
  KEY `id_appartenance` (`id_appartenance`),
  KEY `id_controle` (`id_controle`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=416 ;

--
-- RELATIONS POUR LA TABLE `note`:
--   `id_appartenance`
--       `appartenance` -> `id_appartenance`
--   `id_controle`
--       `controle` -> `id_controle`
--

-- --------------------------------------------------------

--
-- Structure de la table `semestre`
--

CREATE TABLE IF NOT EXISTS `semestre` (
  `id_semestre` int(11) NOT NULL AUTO_INCREMENT,
  `id_formation` int(11) NOT NULL,
  `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `rang` tinyint(4) NOT NULL,
  `annee` year(4) NOT NULL,
  PRIMARY KEY (`id_semestre`),
  KEY `id_formation` (`id_formation`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=167 ;

--
-- RELATIONS POUR LA TABLE `semestre`:
--   `id_formation`
--       `formation` -> `id_formation`
--

-- --------------------------------------------------------

--
-- Structure de la table `ue`
--

CREATE TABLE IF NOT EXISTS `ue` (
  `id_ue` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `libelle` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id_ue`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ;

-- --------------------------------------------------------

--
-- Structure de la table `utilisateur`
--

CREATE TABLE IF NOT EXISTS `utilisateur` (
  `identifiant` varchar(50) NOT NULL,
  `prenom` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `nom` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `sexe` tinyint(1) NOT NULL DEFAULT '1',
  `mail` varchar(50) NOT NULL,
  `mdp` varchar(40) NOT NULL,
  `droits` varchar(44) NOT NULL DEFAULT 'student',
  PRIMARY KEY (`identifiant`),
  UNIQUE KEY `identifiant` (`identifiant`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `utilisateur`
--

INSERT INTO `utilisateur` (`identifiant`, `prenom`, `nom`, `sexe`, `mail`, `mdp`, `droits`) VALUES
('admin', 'monsieur', 'administrateur', 1, 'admin@iut-tlse3.fr', 'lkjdsqlkjdlqksjdlqksjdqlksdjlqksjdqj', 'teacher,admin'),
('admin2', 'madame', 'administratrice', 0, 'mme.admin@iut-tlse3.fr', 'lkjdsqlkjdlqksjdlqksjdqlksdjlqksjdqj', 'admin'),
('lbh1609a', 'HervÃ©', 'LEBLANC', 1, 'herve.leblanc@iut-tlse3.fr', 'lqkjsdlkjsdlkjqsdlkjqsdlkjqsdkjqsldjqsj', 'teacher'),
('ref', 'mlle', 'rÃ©fÃ©rente', 0, 'ref@ref.ref', 'sqldkmsqldksqmlkd', 'master');

--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `appartenance`
--
ALTER TABLE `appartenance`
  ADD CONSTRAINT `appartenance_ibfk_1` FOREIGN KEY (`id_etudiant`) REFERENCES `utilisateur` (`identifiant`),
  ADD CONSTRAINT `appartenance_ibfk_2` FOREIGN KEY (`id_groupe`) REFERENCES `groupe` (`id_groupe`),
  ADD CONSTRAINT `appartenance_ibfk_3` FOREIGN KEY (`id_semestre`) REFERENCES `semestre` (`id_semestre`);

--
-- Contraintes pour la table `controle`
--
ALTER TABLE `controle`
  ADD CONSTRAINT `controle_ibfk_1` FOREIGN KEY (`id_mcc_module`) REFERENCES `mcc_module` (`id_mcc_module`) ON DELETE CASCADE;

--
-- Contraintes pour la table `enseignement`
--
ALTER TABLE `enseignement`
  ADD CONSTRAINT `enseignement_id_enseignant` FOREIGN KEY (`id_enseignant`) REFERENCES `utilisateur` (`identifiant`),
  ADD CONSTRAINT `enseignement_id_groupe` FOREIGN KEY (`id_groupe`) REFERENCES `groupe` (`id_groupe`),
  ADD CONSTRAINT `enseignement_id_mcc_module` FOREIGN KEY (`id_mcc_module`) REFERENCES `mcc_module` (`id_mcc_module`);

--
-- Contraintes pour la table `mcc_module`
--
ALTER TABLE `mcc_module`
  ADD CONSTRAINT `mcc_module_id_mcc_ue` FOREIGN KEY (`id_mcc_ue`) REFERENCES `mcc_ue` (`id_mcc_ue`) ON DELETE CASCADE,
  ADD CONSTRAINT `mcc_module_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE;

--
-- Contraintes pour la table `mcc_ue`
--
ALTER TABLE `mcc_ue`
  ADD CONSTRAINT `mcc_ue_id_semestre` FOREIGN KEY (`id_semestre`) REFERENCES `semestre` (`id_semestre`) ON DELETE CASCADE,
  ADD CONSTRAINT `mcc_ue_id_ue` FOREIGN KEY (`id_ue`) REFERENCES `ue` (`id_ue`) ON DELETE CASCADE;

--
-- Contraintes pour la table `note`
--
ALTER TABLE `note`
  ADD CONSTRAINT `note_id_appartenance` FOREIGN KEY (`id_appartenance`) REFERENCES `appartenance` (`id_appartenance`) ON DELETE CASCADE,
  ADD CONSTRAINT `note_id_controle` FOREIGN KEY (`id_controle`) REFERENCES `controle` (`id_controle`) ON DELETE CASCADE;

--
-- Contraintes pour la table `semestre`
--
ALTER TABLE `semestre`
  ADD CONSTRAINT `semestre_id_formation` FOREIGN KEY (`id_formation`) REFERENCES `formation` (`id_formation`);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;