Add 'course' database

main
Shad Amethyst 2 years ago
parent 6a67a02605
commit 1db4ec7f57

@ -12,8 +12,8 @@ which can then be imported into other MariaDB instances or into a Docker image o
The currently-available images are:
- [`ds52-cafe`](https://hub.docker.com/r/shadamethyst/ds52-cafe)
- [`ds52-course`](https://hub.docker.com/r/shadamethyst/ds52-course)
- *ds52-gescom* (TODO)
- *ds52-course* (TODO)
- [`ds53-emode`](https://hub.docker.com/r/shadamethyst/ds53-emode)
## TODO

@ -0,0 +1,6 @@
FROM mariadb:latest
ADD ds52-course.sql /docker-entrypoint-initdb.d/ds52-course.sql
ENV MARIADB_PASSWORD="course"
ENV MARIADB_USER="course"
ENV MARIADB_ROOT_PASSWORD="ds52-course-root"
ENV MARIADB_DATABASE="course"

@ -0,0 +1,12 @@
"NUMCOUREUR","NOMCOUREUR","VILLECOUREUR","NUMENTR"
1,"ALBERT","BELFORT",4
2,"DUPONT","MULHOUSE",1
3,"MARTIN","BELFORT",1
4,"DURANT","MULHOUSE",2
5,"BARREAU","MONTBELIARD",3
6,"PARRET","SEVENANS",2
7,"PARISSE","BELFORT",1
8,"PARADIS","MONTBELIARD",4
9,"MANILLE","PARIS",3
10,"DALO","BELFORT",4
11,"FILOU","MULHOUSE",3
1 NUMCOUREUR NOMCOUREUR VILLECOUREUR NUMENTR
2 1 ALBERT BELFORT 4
3 2 DUPONT MULHOUSE 1
4 3 MARTIN BELFORT 1
5 4 DURANT MULHOUSE 2
6 5 BARREAU MONTBELIARD 3
7 6 PARRET SEVENANS 2
8 7 PARISSE BELFORT 1
9 8 PARADIS MONTBELIARD 4
10 9 MANILLE PARIS 3
11 10 DALO BELFORT 4
12 11 FILOU MULHOUSE 3

@ -0,0 +1,9 @@
"NUMCOURSE","LIBCOURSE","VILLECOURSE","DATECOURSE"
15,"Course du Lion","MONTBELIARD","15-SEP-03"
16,"Course du Lion","BELFORT","12-SEP-04"
21,"Course du Lion","MONTBELIARD","12-SEP-05"
17,"Marathon","BELFORT","15-OCT-04"
18,"Course du tour","PARIS","17-JAN-05"
19,"Course du Territoire","BELFORT","25-JAN-05"
20,"L'alsacienne","MULHOUSE","30-JUL-05"
99,"Course UTBM","BELFORT","01-SEP-05"
1 NUMCOURSE LIBCOURSE VILLECOURSE DATECOURSE
2 15 Course du Lion MONTBELIARD 15-SEP-03
3 16 Course du Lion BELFORT 12-SEP-04
4 21 Course du Lion MONTBELIARD 12-SEP-05
5 17 Marathon BELFORT 15-OCT-04
6 18 Course du tour PARIS 17-JAN-05
7 19 Course du Territoire BELFORT 25-JAN-05
8 20 L'alsacienne MULHOUSE 30-JUL-05
9 99 Course UTBM BELFORT 01-SEP-05

@ -0,0 +1,82 @@
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
);

@ -0,0 +1,187 @@
-- MariaDB dump 10.19 Distrib 10.11.2-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: course
-- ------------------------------------------------------
-- Server version 10.11.2-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `coureur`
--
DROP TABLE IF EXISTS `coureur`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `coureur` (
`numcoureur` int(11) NOT NULL AUTO_INCREMENT,
`nomcoureur` varchar(255) NOT NULL,
`villecoureur` varchar(255) NOT NULL,
`numentr` int(11) NOT NULL,
PRIMARY KEY (`numcoureur`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `coureur`
--
LOCK TABLES `coureur` WRITE;
/*!40000 ALTER TABLE `coureur` DISABLE KEYS */;
INSERT INTO `coureur` VALUES
(1,'ALBERT','BELFORT',4),
(2,'DUPONT','MULHOUSE',1),
(3,'MARTIN','BELFORT',1),
(4,'DURANT','MULHOUSE',2),
(5,'BARREAU','MONTBELIARD',3),
(6,'PARRET','SEVENANS',2),
(7,'PARISSE','BELFORT',1),
(8,'PARADIS','MONTBELIARD',4),
(9,'MANILLE','PARIS',3),
(10,'DALO','BELFORT',4),
(11,'FILOU','MULHOUSE',3);
/*!40000 ALTER TABLE `coureur` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `course`
--
DROP TABLE IF EXISTS `course`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `course` (
`numcourse` int(11) NOT NULL AUTO_INCREMENT,
`libcourse` varchar(255) NOT NULL,
`villecourse` varchar(255) NOT NULL,
`datecourse` date NOT NULL,
PRIMARY KEY (`numcourse`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `course`
--
LOCK TABLES `course` WRITE;
/*!40000 ALTER TABLE `course` DISABLE KEYS */;
INSERT INTO `course` VALUES
(15,'Course du Lion','MONTBELIARD','2003-09-15'),
(16,'Course du Lion','BELFORT','2004-09-12'),
(17,'Marathon','BELFORT','2004-10-15'),
(18,'Course du tour','PARIS','2005-01-17'),
(19,'Course du Territoire','BELFORT','2005-01-25'),
(20,'L\'alsacienne','MULHOUSE','2005-07-30'),
(21,'Course du Lion','MONTBELIARD','2005-09-12'),
(99,'Course UTBM','BELFORT','2005-09-01');
/*!40000 ALTER TABLE `course` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `entraineur`
--
DROP TABLE IF EXISTS `entraineur`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `entraineur` (
`numentr` int(11) NOT NULL AUTO_INCREMENT,
`nomentr` varchar(255) NOT NULL,
`villeentr` varchar(255) NOT NULL,
`salaireentr` decimal(13,2) DEFAULT NULL,
PRIMARY KEY (`numentr`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `entraineur`
--
LOCK TABLES `entraineur` WRITE;
/*!40000 ALTER TABLE `entraineur` DISABLE KEYS */;
INSERT INTO `entraineur` VALUES
(1,'WEBER','BELFORT',1200.00),
(2,'HARRY','SOCHAUX',760.00),
(3,'FANNIER','BELFORT',1060.00),
(4,'DUBROCK','MONTBELIARD',1372.00),
(5,'JUSTIN','PARIS',915.00);
/*!40000 ALTER TABLE `entraineur` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `participe`
--
DROP TABLE IF EXISTS `participe`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `participe` (
`numcourse` int(11) NOT NULL AUTO_INCREMENT,
`numcoureur` int(11) NOT NULL,
`ordre` int(11) DEFAULT NULL,
PRIMARY KEY (`numcourse`,`numcoureur`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `participe`
--
LOCK TABLES `participe` WRITE;
/*!40000 ALTER TABLE `participe` DISABLE KEYS */;
INSERT INTO `participe` VALUES
(15,2,2),
(15,7,1),
(16,2,3),
(16,4,2),
(16,7,1),
(17,1,5),
(17,3,1),
(17,4,4),
(17,5,2),
(17,6,3),
(17,9,6),
(17,10,6),
(18,1,4),
(18,2,3),
(18,3,2),
(18,7,1),
(18,8,5),
(18,9,7),
(18,10,6),
(19,2,3),
(19,3,4),
(19,4,8),
(19,6,2),
(19,7,1),
(19,9,5),
(20,6,1),
(20,8,2),
(21,3,3),
(21,9,2),
(21,10,1),
(99,2,3),
(99,4,2),
(99,6,1);
/*!40000 ALTER TABLE `participe` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-03-06 8:29:35

@ -0,0 +1,6 @@
"NUMENTR","NOMENTR","VILLEENTR","SALAIREENTR"
1,"WEBER","BELFORT",1200
2,"HARRY","SOCHAUX",760
3,"FANNIER","BELFORT",1060
4,"DUBROCK","MONTBELIARD",1372
5,"JUSTIN","PARIS",915
1 NUMENTR NOMENTR VILLEENTR SALAIREENTR
2 1 WEBER BELFORT 1200
3 2 HARRY SOCHAUX 760
4 3 FANNIER BELFORT 1060
5 4 DUBROCK MONTBELIARD 1372
6 5 JUSTIN PARIS 915

@ -0,0 +1,34 @@
"NUMCOURSE","NUMCOUREUR","ORDRE"
15,2,2
15,7,1
16,2,3
16,4,2
16,7,1
17,1,5
17,3,1
17,4,4
17,5,2
17,6,3
17,9,6
17,10,6
18,1,4
18,2,3
18,3,2
18,7,1
18,8,5
18,9,7
18,10,6
19,2,3
19,3,4
19,6,2
19,4,8
19,7,1
19,9,5
20,6,1
20,8,2
21,9,2
21,10,1
21,3,3
99,2,3
99,4,2
99,6,1
1 NUMCOURSE NUMCOUREUR ORDRE
2 15 2 2
3 15 7 1
4 16 2 3
5 16 4 2
6 16 7 1
7 17 1 5
8 17 3 1
9 17 4 4
10 17 5 2
11 17 6 3
12 17 9 6
13 17 10 6
14 18 1 4
15 18 2 3
16 18 3 2
17 18 7 1
18 18 8 5
19 18 9 7
20 18 10 6
21 19 2 3
22 19 3 4
23 19 6 2
24 19 4 8
25 19 7 1
26 19 9 5
27 20 6 1
28 20 8 2
29 21 9 2
30 21 10 1
31 21 3 3
32 99 2 3
33 99 4 2
34 99 6 1

@ -69,7 +69,14 @@ PRIMARY KEY (article_code)
```
```
LOAD DATA LOCAL INFILE './emode/article_lookup.csv' INTO TABLE article_lookup FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (article_code, article_label, category, sale_price, family_name, family_code);
LOAD DATA LOCAL INFILE './emode/article_lookup.csv' INTO TABLE article_lookup FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (
article_code,
article_label,
category,
sale_price,
family_name,
family_code
);
```
## ARTICLE_LOOKUP_CRITERIA
@ -187,5 +194,14 @@ PRIMARY KEY (id)
```
```
LOAD DATA LOCAL INFILE './emode/shop_facts.csv' INTO TABLE shop_facts FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (id, article_code, color_code, week_key, shop_code, margin, amount_sold, quantity_sold);
LOAD DATA LOCAL INFILE './emode/shop_facts.csv' INTO TABLE shop_facts FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (
id,
article_code,
color_code,
week_key,
shop_code,
margin,
amount_sold,
quantity_sold
);
```

Loading…
Cancel
Save