A sql lab filled with pokemon data

Part4.sql 612B

123456789101112131415161718192021222324
  1. /*Steel pokemon have the most resistances to various other damage types so I figured the highest level
  2. Steel types would be the strongest*/
  3. SELECT
  4. p.name as 'Pokemon Name',
  5. tr.trainername as 'Trainer Name',
  6. ptr.pokelevel AS 'Current Level',
  7. typ.name AS 'Primary Type',
  8. typ2.name AS 'Secondary Type'
  9. FROM
  10. pokemon.pokemon_trainer ptr
  11. JOIN pokemon.pokemons p
  12. ON ptr.pokemon_id = p.id
  13. JOIN pokemon.trainers tr
  14. ON ptr.trainerID = tr.trainerID
  15. JOIN pokemon.types typ
  16. ON p.primary_type = typ.id
  17. JOIN pokemon.types typ2
  18. ON p.secondary_type = typ2.id
  19. WHERE typ.name = 'Steel'
  20. ORDER BY ptr.pokelevel DESC
  21. ;