· 8 years ago · May 16, 2018, 03:22 PM
1drop database if exists voyages;
2
3create database voyages character set = 'utf8';
4
5use voyages;
6create table if not exists voyage(
7 id smallint not null auto_increment,
8 pays varchar(50) not null,
9 ville varchar(50) not null,
10 adresse varchar(50) not null,
11 codepostal int not null,
12 compagnie varchar(50) not null,
13 prix numeric(7,2) not null,
14 primary key(id)
15)engine=innodb;
16
17
18create table if not exists client(
19 nomcli varchar(25) not null,
20 prenomcli varchar(25) not null,
21 telcli varchar(15) not null,
22 email varchar(100) not null,
23 codepostal int not null,
24 ville varchar(50) not null,
25 adresse varchar(100) not null,
26 pays varchar(50) not null,
27 pass varchar(50) not null,
28 primary key(email)
29)engine=innodb;
30
31create table if not exists reservation(
32 reservation_id INT NOT NULL AUTO_INCREMENT,
33 id smallint,
34 email varchar(100),
35 PRIMARY KEY(reservation_id),
36 FOREIGN KEY(id) references voyage(id),
37 FOREIGN KEY(email) references client(email)
38)engine=innodb;