-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbdfilm_SAE203.sql
More file actions
122 lines (94 loc) · 2.42 KB
/
Copy pathbdfilm_SAE203.sql
File metadata and controls
122 lines (94 loc) · 2.42 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
drop table if exists commentaire;
drop table if exists film;
drop table if exists genre;
-- --------------------------------------------------------
--
-- Structure de la table `commentaire`
--
CREATE TABLE `commentaire` (
`idCommentaire` int(11) NOT NULL,
`dateCommentaire` timestamp NOT NULL DEFAULT current_timestamp(),
`note` int(2) NOT NULL,
`pseudo` varchar(15) NOT NULL,
`avis` text DEFAULT NULL,
`idFilm` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Déchargement des données de la table `commentaire`
--
-- --------------------------------------------------------
--
-- Structure de la table `film`
--
CREATE TABLE `film` (
`idFilm` int(11) NOT NULL,
`titre` varchar(70) NOT NULL,
`annee` year(4) NOT NULL,
`duree` int(4) DEFAULT NULL,
`resume` text DEFAULT NULL,
`affiche` tinytext DEFAULT NULL,
`bandeAnnonce` tinytext DEFAULT NULL,
`realisateur` varchar(30) NOT NULL,
`acteurs` varchar(250) NOT NULL,
`idGenre` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Déchargement des données de la table `film`
--
-- --------------------------------------------------------
--
-- Structure de la table `genre`
--
CREATE TABLE `genre` (
`idGenre` int(11) NOT NULL,
`libelle` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Index pour la table `commentaire`
--
ALTER TABLE `commentaire`
ADD PRIMARY KEY (`idCommentaire`),
ADD KEY `idFilm` (`idFilm`);
--
-- Index pour la table `film`
--
ALTER TABLE `film`
ADD PRIMARY KEY (`idFilm`),
ADD KEY `idGenre` (`idGenre`);
--
-- Index pour la table `genre`
--
ALTER TABLE `genre`
ADD PRIMARY KEY (`idGenre`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `commentaire`
--
ALTER TABLE `commentaire`
MODIFY `idCommentaire` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `film`
--
ALTER TABLE `film`
MODIFY `idFilm` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `genre`
--
ALTER TABLE `genre`
MODIFY `idGenre` int(11) NOT NULL AUTO_INCREMENT;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `commentaire`
--
ALTER TABLE `commentaire`
ADD CONSTRAINT `commentaire_ibfk_1` FOREIGN KEY (`idFilm`) REFERENCES `film` (`idFilm`);
--
-- Contraintes pour la table `film`
--
ALTER TABLE `film`
ADD CONSTRAINT `film_ibfk_1` FOREIGN KEY (`idGenre`) REFERENCES `genre` (`idGenre`);
COMMIT;