diff --git a/cafe/create.sql b/cafe/create.sql new file mode 100644 index 0000000..44cead3 --- /dev/null +++ b/cafe/create.sql @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS facture; +CREATE TABLE facture ( + numfacture INT NOT NULL AUTO_INCREMENT, + numtable INT NOT NULL, + numserveur INT NOT NULL, + datefacture DATE NOT NULL, + PRIMARY KEY (numfacture) +); + +LOAD DATA LOCAL INFILE './cafe/facture.csv' INTO TABLE facture +FIELDS TERMINATED BY ',' +ENCLOSED BY '"' +LINES TERMINATED BY '\n' +IGNORE 1 LINES +( + numfacture, + numtable, + numserveur, + @datefacture +) +SET datefacture = STR_TO_DATE(@datefacture, "%d-%b-%y"); + +-- TODO: other tables diff --git a/cafe/ds52-cafe.sql b/cafe/ds52-cafe.sql index 7be050d..7524c3f 100644 --- a/cafe/ds52-cafe.sql +++ b/cafe/ds52-cafe.sql @@ -193,6 +193,7 @@ CREATE TABLE `facture` ( LOCK TABLES `facture` WRITE; /*!40000 ALTER TABLE `facture` DISABLE KEYS */; INSERT INTO `facture` VALUES +(1000,1,53,'2005-12-01'), (1001,5,53,'2005-12-02'), (1002,3,52,'2005-12-02'), (1003,5,50,'2005-12-04'), @@ -305,4 +306,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-02-27 10:30:24 +-- Dump completed on 2023-03-06 8:12:20 diff --git a/cafe/facture.csv b/cafe/facture.csv index 9c3ec6a..a9dac1c 100644 --- a/cafe/facture.csv +++ b/cafe/facture.csv @@ -1,3 +1,4 @@ +"NUMFACTURE","NUMTABLE","NUMSERVEUR","DATEFACTURE" 1000,1,53,"01-DEC-05" 1001,5,53,"02-DEC-05" 1002,3,52,"02-DEC-05"