A sql lab filled with pokemon data

1234567891011121314151617
  1. # Sort the data by finding out which trainer has the strongest pokemon so
  2. # that this will act as a ranking of strongest to weakest trainer.
  3. # You may interpret strongest in whatever way you want, but you will have to explain your decision.
  4. SELECT pokemon.pokemons.name,
  5. pokemon.trainers.trainername,
  6. pokemon.pokemon_trainer.pokelevel,
  7. pokemon.pokemons.primary_type,
  8. pokemon.pokemons.secondary_type
  9. FROM pokemon.pokemons,
  10. pokemon.trainers,
  11. pokemon.pokemon_trainer
  12. WHERE pokemon.pokemons.id = pokemon.pokemon_trainer.pokemon_id
  13. AND pokemon.pokemon_trainer.trainerID = pokemon.trainers.trainerID
  14. ORDER BY ((attack + defense + spatk + spdef + speed + hp) * pokelevel) DESC;
  15. # Strongest Pokemon was determined by adding the attack, defense, spatk, spdef, speed and hp.
  16. # Then multiplying the sum by the pokelevel.