From 1d35e1b18489c52b4f6de0ba7bc32f87dde3a6ab Mon Sep 17 00:00:00 2001 From: medina5 Date: Sat, 27 Sep 2025 19:51:23 +0200 Subject: [PATCH] bibliotheque --- bibliotheque/bibliotheque.sql | 188 ++++++++++++++++++++++++++++++++++ data/chinook/albums.csv | 35 +++++++ data/chinook/artists.csv | 48 +++++++++ data/chinook/employees.csv | 4 +- data/chinook/tracks.csv | 9 ++ 5 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 bibliotheque/bibliotheque.sql diff --git a/bibliotheque/bibliotheque.sql b/bibliotheque/bibliotheque.sql new file mode 100644 index 0000000..d473483 --- /dev/null +++ b/bibliotheque/bibliotheque.sql @@ -0,0 +1,188 @@ +-- Lookup tables +drop table if exists langues; +drop table if exists pays; +drop table if exists statuts; + +drop table if exists auteurs; +drop table if exists editeurs; +drop table if exists series; +drop table if exists relations; +drop table if exists oeuvres; +drop table if exists participe; +drop table if exists editions; +drop table if exists exemplaires; +drop table if exists genres; +drop table if exists collections; + +drop table if exists adherents; +drop table if exists adresses; +drop table if exists adherent_adresse; + +drop table if exists commande_historique; +drop table if exists commande_ligne; +drop table if exists commande; +drop table if exists commande_statut; +drop table if exists livraison_methode; + +-- +PRAGMA integrity_check; +PRAGMA foreign_key_check; + +CREATE TABLE langues ( + langue_id INTEGER, + langue_code VARCHAR(5) PRIMARY KEY, + langue TEXT +); + +CREATE TABLE auteurs ( + auteur_id INTEGER PRIMARY KEY, + Nom TEXT DEFAULT NULL +); + +CREATE TABLE editeurs ( + editeur_id INTEGER PRIMARY KEY, + Nom TEXT +); + +CREATE TABLE series ( + serie_id INTEGER PRIMARY KEY, + Nom TEXT +); + +CREATE TABLE oeuvres ( + oeuvre_id INTEGER PRIMARY KEY, + titre TEXT, + isbn13 TEXT, + langue_code VARCHAR(5) REFERENCES langues (langue_code), + num_pages INTEGER, + publication_date DATE, + editeur_id INTEGER, + genre_id INTEGER, + serie_id INTEGER, + CONSTRAINT fk_oeuvre_editeur FOREIGN KEY (editeur_id) REFERENCES editeurs (editeur_id), + CONSTRAINT fk_oeuvre_genre FOREIGN KEY (genre_id) REFERENCES genres (genre_id), + CONSTRAINT fk_oeuvre_serie FOREIGN KEY (serie_id) REFERENCES series (serie_id) +); + +CREATE TABLE editions ( + edition_id INTEGER PRIMARY KEY, + oeuvre_id INTEGER REFERENCES oeuvres (oeuvre_id), + editeur_id INTEGER REFERENCES editeurs (editeur_id), + isbn13 TEXT, + langue_code VARCHAR(5) REFERENCES langues (langue_code), + publication_date DATE, + num_pages INTEGER, + num_catalogue INTEGER + informations TEXT +); + +CREATE TABLE exemplaires ( + exemplaire_id INTEGER PRIMARY KEY, + edition_id INTEGER REFERENCES editions (edition_id), + date_achat DATE, + prix_achat NUMERIC, + etat TEXT +); + +CREATE TABLE relations ( + reference_id INTEGER REFERENCES oeuvres (oeuvre_id), + oeuvre_id INTEGER REFERENCES oeuvres (oeuvre_id), + [type] TEXT, + CONSTRAINT pk_relation PRIMARY KEY (reference_id, oeuvre_id) +); + + +CREATE TABLE genres ( + genre_id INTEGER PRIMARY KEY, + genre TEXT +); + + +CREATE TABLE participe ( + oeuvre_id INTEGER NOT NULL REFERENCES oeuvres (oeuvre_id), + auteur_id INTEGER NOT NULL REFERENCES auteurs (auteur_id), + fonction TEXT, + alias TEXT + CONSTRAINT pk_oeuvreauteur PRIMARY KEY (oeuvre_id, auteur_id) +); + + +CREATE TABLE incorpore ( + oeuvre_id INTEGER NOT NULL REFERENCES oeuvres (oeuvre_id), + edition_id INTEGER NOT NULL REFERENCES editions (edition_id) +) + +CREATE TABLE statuts ( + statut_id INTEGER PRIMARY KEY, + statut TEXT +); + +CREATE TABLE pays ( + pays_id INTEGER PRIMARY KEY, + pays_name TEXT +); + +CREATE TABLE adresses ( + adresse_id INTEGER PRIMARY KEY, + numero TEXT, + voie TEXT, + ville TEXT, + pays_id INTEGER REFERENCES pays (pays_id) +); + +CREATE TABLE adherents ( + adherent_id INTEGER PRIMARY KEY, + prenom TEXT NOT NULL, + nom TEXT NOT NULL, + email TEXT, + naissance CHAR(10), + statut_id INTEGER, + CONSTRAINT fk_a_statut FOREIGN KEY (statut_id) REFERENCES statuts (statut_id) +); + +CREATE TABLE adherent_adresse ( + adherent_id INTEGER NOT NULL, + adresse_id INTEGER NOT NULL, + statut_id INTEGER, + CONSTRAINT pk_adherent_adresse PRIMARY KEY (adherent_id, adresse_id), + CONSTRAINT fk_aa_adherent FOREIGN KEY (adherent_id) REFERENCES adherents (adherent_id), + CONSTRAINT fk_aa_adresse FOREIGN KEY (adresse_id) REFERENCES adresses (adresse_id), + CONSTRAINT fk_aa_statut FOREIGN KEY (statut_id) REFERENCES statuts (statut_id) +); + +CREATE TABLE livraison_methode ( + methode_id INTEGER PRIMARY KEY, + methode_name TEXT, + cout NUMERIC +); + +CREATE TABLE commande ( + commande_id INTEGER PRIMARY KEY, + commande_date DATETIME, + date_echeance DATE, + adherent_id INTEGER REFERENCES adherents (adherent_id), + livraison_methode_id INTEGER REFERENCES livraison_methode (methode_id), + dest_adresse_id INTEGER REFERENCES adresses (adresse_id) +); + +CREATE TABLE commande_statut ( + statut_id INTEGER PRIMARY KEY, + statut_value TEXT +); + +CREATE TABLE commande_ligne ( + ligne_id INTEGER PRIMARY KEY, + commande_id INTEGER REFERENCES commande (commande_id), + exemplaire_id INTEGER REFERENCES exemplaires (exemplaire_id), + cout NUMERIC, + date_retour DATETIME +); + +CREATE TABLE commande_historique ( + historique_id INTEGER PRIMARY KEY, + commande_id INTEGER REFERENCES commande (commande_id), + statut_id INTEGER REFERENCES commande_statut (statut_id), + statut_date DATETIME +); + +-- ***** diff --git a/data/chinook/albums.csv b/data/chinook/albums.csv index 9305124..b4e1965 100644 --- a/data/chinook/albums.csv +++ b/data/chinook/albums.csv @@ -346,3 +346,38 @@ 345,"Monteverdi: L'Orfeo",273,2005, 346,"Mozart: Chamber Music",274,2019, 347,"Koyaanisqatsi (Soundtrack from the Motion Picture)",275,1996, +348,"forever, Michael",277, +349,Off the Wall,277, +350,Thriller,277,1982,Epic +351,Bad,277, +352,Dangerous,277, +353,Sabotage,12, +354,Master of Reality,12, +355,Paranoid,12, +356,British Steel,98, +357,Sad Wings of Destiny,98, +358,Sin After Sin,98, +359,Stained Class,98, +360,Killing Machine,98, +361,Metal Heart,2, +362,Breaker,2, +363,"C'est mon dernier bal",286, +364,"Marche à l'ombre",286, +365,Morgane de toi,286, +366,Ma gonzesse,286, +367,"Viens chez moi, j'habite chez une copine",286, +368,Un Olympia pour moi tout seul,286, +369,Julien,324, +370,Un autre monde,1980, +371,Mon fils ma bataille,322, +372,"Dieu que c’est beau",322, +373,"Sauver l’amour",322, +374,Vivre ou survivre,322, +375,"L’Aziza",322, +376,Dancing Disco,323, +377,Tout pour la musique,323, +378,Débranche !,323, +379,Rumours,278, +384,Blackout,280, +385,Lovedrive,280, +386,"Fini, la comédie / Marjolaine",324, diff --git a/data/chinook/artists.csv b/data/chinook/artists.csv index 525ff55..b9ca28c 100644 --- a/data/chinook/artists.csv +++ b/data/chinook/artists.csv @@ -274,3 +274,51 @@ 273,"C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu" 274,"Nash Ensemble" 275,"Philip Glass Ensemble" +276,David Bowie +277,Michael Jackson +278,Fleetwood Mac +279,Rainbow +280,Scorpions +281,Michael Schenker Group +282,Queensrÿche +283,Trust +284,Supertramp +285,Blue Öyster Cult +286,Renaud +287,W.A.S.P. +288,AC/DC +289,Metal Church +290,Saxon +291,Motörhead +292,Dio +293,Helloween +294,Big Brother and the Holding Company +295,Janis Joplin +296,Janis Joplin & the Full Tilt Boogie Band +297,Dream Theater +298,Tokyo Blade +299,Twisted Sister +301,Warlock +302,Ratt +303,Badlands +304,ZZ Top +305,Queen +306,Rammstein +307,Van Halen +308,Aerosmith +309,Mötley Crüe +310,Heart +311,Nina Simone +312,Juice Newton +313,P.P. Arnold +314,Joya Landis +315,The Tremeloes +316,Billie Davis +317,Evie Sands +318,Merrilee Rush +319,Melba Montgomery +320,Mary Carewe +321,Paul McCartney & Michael Jackson +322,Daniel Balavoine +323,France Gall +324,Dalida diff --git a/data/chinook/employees.csv b/data/chinook/employees.csv index 51b6486..36c99a4 100644 --- a/data/chinook/employees.csv +++ b/data/chinook/employees.csv @@ -5,5 +5,5 @@ 4,"Park","Margaret","Sales Support Agent",2,"1947-09-19 00:00:00","2003-05-03 00:00:00","683 10 Street SW","Calgary","AB","Canada","T2P 5G3","+1 (403) 263-4423","+1 (403) 263-4289","margaret@chinookcorp.com" 5,"Johnson","Steve","Sales Support Agent",2,"1965-03-03 00:00:00","2003-10-17 00:00:00","7727B 41 Ave","Calgary","AB","Canada","T3B 1Y7","1 (780) 836-9987","1 (780) 836-9543","steve@chinookcorp.com" 6,"Mitchell","Michael","IT Manager",1,"1973-07-01 00:00:00","2003-10-17 00:00:00","5827 Bowness Road NW","Calgary","AB","Canada","T3B 0C5","+1 (403) 246-9887","+1 (403) 246-9899","michael@chinookcorp.com" -7,"King","Robert","IT Staff",6,"1970-05-29 00:00:00","2004-01-02 00:00:00","590 Columbia Boulevard West","Lethbridge","AB","Canada","T1K 5N8","+1 (403) 456-9986","+1 (403) 456-8485","robert@chinookcorp.com" -8,"Callahan","Laura","IT Staff",6,"1968-01-09 00:00:00","2004-03-04 00:00:00","923 7 ST NW","Lethbridge","AB","Canada","T1H 1Y8","+1 (403) 467-3351","+1 (403) 467-8772","laura@chinookcorp.com" +7,"Villemin","Grégory","IT Staff",6,"1970-05-29 00:00:00","2004-01-02 00:00:00","590 Columbia Boulevard West","Lethbridge","AB","Canada","T1K 5N8","+1 (403) 456-9986","+1 (403) 456-8485","robert@chinookcorp.com" +8,"Herblay","Evaëlle","IT Staff",6,"1968-01-09 00:00:00","2004-03-04 00:00:00","11 rue de l'Université","Saint-Dié-des-Vosges","FR-LO","France","88100","+33 3 72 74 95 00","+1 (403) 467-8772","evaelle@chinookcorp.com" diff --git a/data/chinook/tracks.csv b/data/chinook/tracks.csv index 93f8ea9..bf76091 100644 --- a/data/chinook/tracks.csv +++ b/data/chinook/tracks.csv @@ -3502,3 +3502,12 @@ 3501,"L'orfeo, Act 3, Sinfonia (Orchestra)",345,2,24,"Claudio Monteverdi",66639,1189062,0.99 3502,"Quintet for Horn, Violin, 2 Violas, and Cello in E Flat Major, K. 407/386c: III. Allegro",346,2,24,"Wolfgang Amadeus Mozart",221331,3665114,0.99 3503,"Koyaanisqatsi",347,2,10,"Philip Glass",206005,3305164,0.99 +3503,Wanna Be Startin' Somethin',350,3,9,"Michael Jackson",362000,1.10 +3504,Baby Be Mine,350,3,9,"Rod Temperton",260000,260000,1.10 +3505,The Girl Is Mine,350,3,9,"Michael Jackson",222000,222000,1.10 +3506,Thriller,350,3,9,"Rod Temperton",357000,357000,1.80 +3507,Beat It,350,3,9,"Michael Jackson",257000,257000,1.50 +3508,Billie Jean,350,3,9,"Michael Jackson",297000,297000,1.50 +3509,Human Nature,350,3,9,"John Bettis, Steve Porcaro",245000,245000,0.90 +3510,P.Y.T. (Pretty Young Thing),350,3,9,"James Ingram, Quincy Jones",238000,238000,0.90 +3511,The Lady In My Life,350,3,9,"Rod Temperton",297000,297000,0.90