You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.7 KiB
83 lines
1.7 KiB
2 years ago
|
DROP TABLE IF EXISTS coureur;
|
||
|
CREATE TABLE coureur (
|
||
|
numcoureur INT NOT NULL AUTO_INCREMENT,
|
||
|
nomcoureur VARCHAR(255) NOT NULL,
|
||
|
villecoureur VARCHAR(255) NOT NULL,
|
||
|
numentr INT NOT NULL,
|
||
|
PRIMARY KEY (numcoureur)
|
||
|
);
|
||
|
|
||
|
LOAD DATA LOCAL INFILE './course/coureur.csv' INTO TABLE coureur
|
||
|
FIELDS TERMINATED BY ','
|
||
|
ENCLOSED BY '"'
|
||
|
LINES TERMINATED BY '\n'
|
||
|
IGNORE 1 LINES
|
||
|
(
|
||
|
numcoureur,
|
||
|
nomcoureur,
|
||
|
villecoureur,
|
||
|
numentr
|
||
|
);
|
||
|
|
||
|
DROP TABLE IF EXISTS course;
|
||
|
CREATE TABLE course (
|
||
|
numcourse INT NOT NULL AUTO_INCREMENT,
|
||
|
libcourse VARCHAR(255) NOT NULL,
|
||
|
villecourse VARCHAR(255) NOT NULL,
|
||
|
datecourse DATE NOT NULL,
|
||
|
PRIMARY KEY (numcourse)
|
||
|
);
|
||
|
|
||
|
LOAD DATA LOCAL INFILE './course/course.csv' INTO TABLE course
|
||
|
FIELDS TERMINATED BY ','
|
||
|
ENCLOSED BY '"'
|
||
|
LINES TERMINATED BY '\n'
|
||
|
IGNORE 1 LINES
|
||
|
(
|
||
|
numcourse,
|
||
|
libcourse,
|
||
|
villecourse,
|
||
|
@datecourse
|
||
|
)
|
||
|
SET datecourse = STR_TO_DATE(@datecourse, "%d-%b-%y");
|
||
|
|
||
|
DROP TABLE IF EXISTS entraineur;
|
||
|
CREATE TABLE entraineur (
|
||
|
numentr INT NOT NULL AUTO_INCREMENT,
|
||
|
nomentr VARCHAR(255) NOT NULL,
|
||
|
villeentr VARCHAR(255) NOT NULL,
|
||
|
salaireentr DECIMAL(13,2),
|
||
|
PRIMARY KEY (numentr)
|
||
|
);
|
||
|
|
||
|
LOAD DATA LOCAL INFILE './course/entraineur.csv' INTO TABLE entraineur
|
||
|
FIELDS TERMINATED BY ','
|
||
|
ENCLOSED BY '"'
|
||
|
LINES TERMINATED BY '\n'
|
||
|
IGNORE 1 LINES
|
||
|
(
|
||
|
numentr,
|
||
|
nomentr,
|
||
|
villeentr,
|
||
|
salaireentr
|
||
|
);
|
||
|
|
||
|
DROP TABLE IF EXISTS participe;
|
||
|
CREATE TABLE participe (
|
||
|
numcourse INT NOT NULL AUTO_INCREMENT,
|
||
|
numcoureur INT NOT NULL,
|
||
|
ordre INT,
|
||
|
PRIMARY KEY (numcourse,numcoureur)
|
||
|
);
|
||
|
|
||
|
LOAD DATA LOCAL INFILE './course/participe.csv' INTO TABLE participe
|
||
|
FIELDS TERMINATED BY ','
|
||
|
ENCLOSED BY '"'
|
||
|
LINES TERMINATED BY '\n'
|
||
|
IGNORE 1 LINES
|
||
|
(
|
||
|
numcourse,
|
||
|
numcoureur,
|
||
|
ordre
|
||
|
);
|