Commit 13d78f64 authored by Martin Schneider's avatar Martin Schneider
Browse files

Merge branch 'main' of gitlab.utc.fr:obordeau/nf18_projet1 into main

parents 72357224 9ee516ab
......@@ -4,3 +4,4 @@ Et pour les oeuvres nous avons utilisé une liste avec leur ids.
Pour écrire les tables des oeuvres en JSON, on doit adopter une des deux méthodes pour gérer les clés étrangère:<br>
-soit on met juste l'id correspondant <br>
-soit on redéfinit à chaque fois (imbrication redondante)
Si par exemple on choisit la première méthode, l'attribut auteur serait un entier et expo une liste d'entier.
\ No newline at end of file
<mxfile host="app.diagrams.net" modified="2021-11-03T11:45:44.484Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36" etag="BAqdeIJBVgELe2pZdZs9" version="15.6.6" type="device"><diagram id="YENaLjN_NxkEbvXbnhcM" name="Page-1">7V1bd5s6Fv41fmyWxZ3HxGk7Z07S09N0Ju28ZKlGtmkxeAAncX/9ETayQVvm4iDwhdWulaDIGPa3tbXvGqij+evHEC9m94FDvIEydF4H6u1AUdBQteiPZGSVjphaOjINXScd2w08uL8J+2g6unQdEuUmxkHgxe4iPzgOfJ+M49wYDsPgJT9tEnj5b13gKQEDD2PswdFH14lnm1FLMXfj/yLudMa+GRn25i9zzCanbxLNsBO8ZIbU9wN1FAZBvPlt/joiXkI9RpfN5z7s+ev2wULix1U+8OfTp9+69dfEx1+ew4l7/fKfx/++S+/yjL1l+sKfQxLFOMZuSNLnjleMGNGLO/ewT69uJoEfP6R/QfR6PHM95w6vgmXyMPQO41/s6mYWhO5vOh976WT65zBOsVaHuRkPySfpcDJKn4TO+czeEHFD9/g1N/EOR3E6MA48Dy8i98f2+eY4nLr+TRDHwTydBAnIqEHCmLxmhlKCfiTBnMThik55ZXyQgpuyt2ql1y87XkFaOjbL8ImdjuGUPafbW+8QpL+kINYAVAGA0un0KdXr5JN+TKYkTK7Nm19kNTBvAcb0zeM1RGHwi4wCLwjpuB9sQHc9j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+cEgy4x8=</diagram></mxfile>
\ No newline at end of file
CReate view vOeuvres as
SELECT oe.ido, oe.titre, oe.dimensions, oe.type, oe.date_crea, oe.auteur, NULL as prix, NULL as dateacq FROM oeuvre_ext oe
UNION ALL
SELECT ol.ido, ol.titre, ol.dimensions, ol.type, ol.date_crea, ol.auteur, ol.prix_acq as prix, ol.date_acq as dates FROM oeuvre_louvre ol;
......@@ -133,9 +133,9 @@ def liste_expos_permanentes():
raw = cur.fetchone()
print("\nListe des expositions permanentes")
while raw:
print(f"Nom de l'exposition : {raw[0]}\n")
print()
print(f"Nom de l'exposition : {raw[0]}")
raw = cur.fetchone()
print()
def liste_expos_temporaires():
......@@ -172,25 +172,43 @@ def liste_oeuvres_louvre():
def info_expo():
cur = conn.cursor()
tmp = 0
sql = "SELECT nom from expo_perm;"
cur.execute(sql)
raw = cur.fetchone()
print("\nLes exposition permanentes sont:")
while raw:
print(f"{raw[0]}")
raw = cur.fetchone()
print()
sql = "SELECT nom from expo_temp;"
cur.execute(sql)
raw = cur.fetchone()
print("Les exposition temporaires sont:")
while raw:
print(f"{raw[0]}")
raw = cur.fetchone()
print()
nom = input(
"\nVous voulez connaitre des informations sur quelle exposition ?")
"Vous voulez connaitre des informations sur quelle exposition ?\n")
sql = f"SELECT expo, Count(*), Avg(prix_acq) FROM OEUVRE_LOUVRE GROUP BY expo HAVING expo='{nom}'"
cur.execute(sql)
raw = cur.fetchone()
if raw:
print(f"Exposition {raw[0]}")
print(f"\nExposition : {raw[0]}")
print(f" Nombre d'oeuvres : {raw[1]}")
print(f" Prix moyen d'acquisition : {raw[2]:.2f}")
print()
tmp = 1
sql = f"SELECT expo, Count(*) FROM OEUVRE_EXT GROUP BY expo HAVING expo='{nom}'"
cur.execute(sql)
raw = cur.fetchone()
if raw:
print(f"Exposition {raw[0]}")
print(f"\nExposition {raw[0]}")
print(f" Nombre d'oeuvres : {raw[1]}")
print()
tmp = 1
if tmp == 0:
print("L'exposition n'existe pas")
print("\nL'exposition n'existe pas\n")
def afficher_guide_expo():
......@@ -200,14 +218,28 @@ def afficher_guide_expo():
choixExpo = input(
"\nExposition permanente (1) ou exposition temporaire (2)\n")
expo = input("\nEntrez le nom de l'exposition:\n")
if(choixExpo == '1'):
sql = "SELECT nom from expo_perm;"
cur.execute(sql)
raw = cur.fetchone()
print("\nLes exposition permanentes sont:")
while raw:
print(f"{raw[0]}")
raw = cur.fetchone()
expocol = "expoperm"
affecter = "affecter_perm"
else:
sql = "SELECT nom from expo_temp;"
cur.execute(sql)
raw = cur.fetchone()
print("\nLes exposition temporaires sont:")
while raw:
print(f"{raw[0]}")
raw = cur.fetchone()
expocol = "expotemp"
affecter = "affecter_temp"
expo = input("\nEntrez le nom de l'exposition:\n")
sql = f"SELECT idg, nom, prenom FROM guide JOIN {affecter} as a ON a.guide=guide.idg WHERE a.{expocol} = '{expo}' GROUP BY nom, prenom, idg;"
cur.execute(sql)
......@@ -302,14 +334,14 @@ def liste_oeuvre_periode():
def temp_moyen_pret():
cur = conn.cursor()
sql = "SELECT idm, nom, adresse, AVG(ROUND(fin - debut)) FROM Prete JOIN Musee_ext ON prete.musee = musee_ext.IDM GROUP BY idm, musee_ext adresse, nom;"
sql = "SELECT idm, nom, adresse, AVG(ROUND(fin - debut)) FROM Prete JOIN Musee_ext ON prete.musee = musee_ext.IDM GROUP BY idm, musee_ext, adresse, nom;"
cur.execute(sql)
raw = cur.fetchone()
print("Temps moyen d'un prêt (par musée):")
while raw:
print(f"musée partenaire : {raw[0]} :")
print(f" adresse : {raw[1]}")
print(f" temps moyen des prêts : {raw[2]} jours")
print(f"musée partenaire : {raw[1]}")
print(f" adresse : {raw[2]}")
print(f" temps moyen des prêts : {raw[3]} jours")
print()
raw = cur.fetchone()
......@@ -324,13 +356,17 @@ def informations_oeuvres():
print("Informations sur chaque oeuvre :")
while raw:
if raw[2] != None:
print(f"Nom de l'oeuvre : {raw[1]} (id:{raw[0]}) ")
print(f" prix d'acquisition : {raw[2]}")
print(f" prix total des {raw[3]} rennovation {raw[4]} euros ")
print(f"Nom de l'oeuvre : {raw[1]}")
print(f" Prix d'acquisition : {raw[2]}")
if raw[3] != 0:
print(
f" Prix total des {raw[3]} rennovation {raw[4]} euros")
else:
print(" Cette oeuvre n'a jamais été restaurée")
print()
else:
print(f"Nom de l'oeuvre : {raw[1]} (id:{raw[0]}) ")
print(" empruntée d'un autre musée")
print(f"Nom de l'oeuvre : {raw[1]}")
print(" Empruntée d'un autre musée")
print()
raw = cur.fetchone()
......
......@@ -154,6 +154,16 @@ CREATE TABLE Panneau(
PRIMARY KEY (ID, salle)
);
CREATE view vOeuvres as
SELECT oe.ido, oe.titre, oe.dimensions, oe.type, oe.date_crea, oe.auteur, NULL as prix, NULL as dateacq FROM oeuvre_ext oe
UNION ALL
SELECT ol.ido, ol.titre, ol.dimensions, ol.type, ol.date_crea, ol.auteur, ol.prix_acq as prix, ol.date_acq as dates FROM oeuvre_louvre ol;
CREATE VIEW vExpos AS
SELECT * FROM Expo_Perm
UNION ALL
SELECT nom FROM Expo_Temp ;
INSERT INTO Artiste (nom, prenom, naiss, mort) VALUES ('Rodin', 'Auguste', TO_DATE('1840-11-12', 'YYYY-MM-DD'), TO_DATE('1917-11-17', 'YYYY-MM-DD'));
INSERT INTO Artiste (nom, prenom, naiss, mort) VALUES ('De Vinci', 'Léonard', TO_DATE('1452-04-14', 'YYYY-MM-DD'), TO_DATE('1519-05-02', 'YYYY-MM-DD'));
INSERT INTO Artiste (nom, prenom, naiss, mort) VALUES ('Monet', 'Claude', TO_DATE('1840-11-14', 'YYYY-MM-DD'), TO_DATE('1926-12-05', 'YYYY-MM-DD'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment