You are on page 1of 3

mysql> create database boutique_en_ligne;

Query OK, 1 row affected (0.01 sec)

mysql> use boutique_en_ligne;

Database changed

mysql> create table users(

-> id int(11) primary key auto_increment,

-> fullname varchar(32),

-> email varchar(64),

-> address varchar(128),

-> phone varchar(32),

-> birthdate date

-> );

Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> create table categories(

-> id int(11) primary key auto_increment,

-> name varchar(32)

-> );

Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> create table manifactors(

-> id int(11) primary key auto_increment,

-> name varchar(32),

-> address varchar(128),

-> phone varchar(32)

-> );

Query OK, 0 rows affected, 1 warning (0.02 sec)


mysql> create table shipment_state(

-> id int(11) primary key auto_increment,

-> state varchar(20)

-> );

Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> create table products(

-> ref int(11) primary key auto_increment,

-> name varchar(64),

-> description varchar(256),

-> price float,

-> manifactor int(11),category int(11),

-> disponibility tinyint(1),

-> foreign key (manifactor) references manifactors(id),

-> foreign key (category) references categories(id)

-> );

Query OK, 0 rows affected, 4 warnings (0.02 sec)

mysql> create table discounts(

-> id int(11) primary key auto_increment,

-> product int(11),

-> discount float,

-> starting_date date,

-> expirition_date date,

-> foreign key (product) references products(ref)

-> );

Query OK, 0 rows affected, 2 warnings (0.01 sec)


mysql> create table sales(

-> id int(11) primary key auto_increment,

-> user int(11),

-> product int(11),

-> quantity int(11),

-> coupon_value float,

-> foreign key (user) references users(id),

-> foreign key (product) references products(id)

-> );

Query OK, 0 rows affected, 4 warnings (0.02 sec)

mysql> create table shipments(

-> id int(11) primary key auto_increment,

-> sale int(11),

-> confirmation_date date,

-> shipment_date date,

-> state int(11),

-> foreign key (sale) references sales(id),

-> foreign key (state) references shipment_state(id)

-> );

Query OK, 0 rows affected, 3 warnings (0.02 sec)

You might also like