diff --git a/PostgreSQL/src/functions.sql b/PostgreSQL/src/functions.sql index 56b4309..2cc0c19 100644 --- a/PostgreSQL/src/functions.sql +++ b/PostgreSQL/src/functions.sql @@ -1,5 +1,4 @@ -DROP FUNCTION pieces_membre(integer); CREATE OR REPLACE FUNCTION pieces_membre(int) RETURNS TABLE(id_piece int, quantite_piece int) AS $$ diff --git a/PostgreSQL/src/select.sql b/PostgreSQL/src/select.sql index 9d18882..1be22cf 100644 --- a/PostgreSQL/src/select.sql +++ b/PostgreSQL/src/select.sql @@ -66,7 +66,8 @@ LIMIT 5 SELECT id_modele, AVG(note_noter) as note_moyenne FROM noter -GROUP BY id_modele +NATURAL JOIN modeles +GROUP BY modeles.id_modele ORDER BY note_moyenne DESC ;