-
Notifications
You must be signed in to change notification settings - Fork 0
/
kalo.sql
106 lines (79 loc) · 3.44 KB
/
kalo.sql
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
#------------------------------------------------------------
# Script MySQL.
#------------------------------------------------------------
#------------------------------------------------------------
# Table: Type
#------------------------------------------------------------
CREATE TABLE Type(
id_type Int Auto_increment NOT NULL ,
type Varchar (100) NOT NULL
,CONSTRAINT Type_PK PRIMARY KEY (id_type)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Artiste
#------------------------------------------------------------
CREATE TABLE Artiste(
id_artiste Int Auto_increment NOT NULL ,
nom_artiste Varchar (100) NOT NULL
,CONSTRAINT Artiste_PK PRIMARY KEY (id_artiste)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Album
#------------------------------------------------------------
CREATE TABLE Album(
id_album Int Auto_increment NOT NULL ,
nom_album Varchar (50) NOT NULL ,
photo Varchar (50) NOT NULL ,
id_artiste Int NOT NULL
,CONSTRAINT Album_PK PRIMARY KEY (id_album)
,CONSTRAINT Album_Artiste_FK FOREIGN KEY (id_artiste) REFERENCES Artiste(id_artiste)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Musique
#------------------------------------------------------------
CREATE TABLE Musique(
id_chant Int Auto_increment NOT NULL ,
titre Varchar (50) NOT NULL ,
photo_couverture Varchar (250) NOT NULL ,
id_album Int NOT NULL ,
id_artiste Int NOT NULL
,CONSTRAINT Musique_PK PRIMARY KEY (id_chant)
,CONSTRAINT Musique_Album_FK FOREIGN KEY (id_album) REFERENCES Album(id_album)
,CONSTRAINT Musique_Artiste0_FK FOREIGN KEY (id_artiste) REFERENCES Artiste(id_artiste)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Media
#------------------------------------------------------------
CREATE TABLE Media(
id_media Int Auto_increment NOT NULL ,
media Varchar (100) NOT NULL ,
id_chant Int NOT NULL ,
id_type Int NOT NULL
,CONSTRAINT Media_PK PRIMARY KEY (id_media)
,CONSTRAINT Media_Musique_FK FOREIGN KEY (id_chant) REFERENCES Musique(id_chant)
,CONSTRAINT Media_Type0_FK FOREIGN KEY (id_type) REFERENCES Type(id_type)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Tournee
#------------------------------------------------------------
CREATE TABLE Tournee(
id_tournee Int Auto_increment NOT NULL ,
date_tournee Date NOT NULL ,
lieu Varchar (250) NOT NULL ,
image Varchar (250) NOT NULL ,
id_artiste Int NOT NULL
,CONSTRAINT Tournee_PK PRIMARY KEY (id_tournee)
,CONSTRAINT Tournee_Artiste_FK FOREIGN KEY (id_artiste) REFERENCES Artiste(id_artiste)
)ENGINE=InnoDB;
#------------------------------------------------------------
# Table: Reservation
#------------------------------------------------------------
CREATE TABLE Reservation(
id_reservation Int Auto_increment NOT NULL ,
date_debut Datetime NOT NULL ,
date_fin Datetime NOT NULL ,
nbre_billet Varchar (50) NOT NULL ,
id_tournee Int NOT NULL
,CONSTRAINT Reservation_PK PRIMARY KEY (id_reservation)
,CONSTRAINT Reservation_Tournee_FK FOREIGN KEY (id_tournee) REFERENCES Tournee(id_tournee)
)ENGINE=InnoDB;