mpierse преди 6 години
родител
ревизия
9ab93354c5
променени са 1 файла, в които са добавени 8 реда и са изтрити 9 реда
  1. 8
    9
      Queries

+ 8
- 9
Queries Целия файл

@@ -64,16 +64,15 @@ GROUP BY pt.pokemon_id
64 64
 HAVING COUNT(*)=1
65 65
     ) AS once;
66 66
 
67
-/*Final Report*/
68
-SELECT p.name as Name, tr.trainername as Trainer, pt.pokelevel as Level, t.name AS PrimaryType, t.name AS SecondaryType
69
-FROM types t
70
-JOIN pokemons p
67
+/*Final Report- I sorted the pokemon according to their pokeLevel, then attak level, then defense level to show the trainer with the strogest Pokemon at the top. I know nothing about pokemon except what I've learned in this Lab.*/
68
+SELECT p.name as Name, tr.trainername as Trainer, pt.pokelevel as Level, t.name AS PrimaryType, t2.name AS SecondaryType
69
+FROM pokemon.pokemons p
70
+JOIN types t
71 71
 ON t.id=p.primary_type
72
-JOIN pokemons s
73
-ON t.id=s.secondary_type
72
+JOIN types t2
73
+ON t2.id=p.secondary_type
74 74
 JOIN pokemon_trainer pt
75 75
 ON p.id=pt.pokemon_id
76 76
 JOIN trainers tr
77
-ON pt.trainerID=tr.trainerID;
78
-
79
-
77
+ON pt.trainerID=tr.trainerID
78
+ORDER BY pt.pokelevel DESC, pt.attack DESC , pt.defense DESC;