A sql lab filled with pokemon data

pokemon_part4.sql 791B

123456789101112131415
  1. /*Final Report
  2. Directions: Write a query that returns the following collumns:
  3. | Pokemon Name | Trainer Name | Level | Primary Type | Secondary Type |
  4. |:------------:|:------------:|:-----:|:------------:|:--------------:|
  5. | Pokemon's name| Trainer's name| Current Level| Primary Type Name| Secondary Type Name|
  6. Sort the data by finding out which trainer has the strongest pokemon so that this will act as a ranking of strongest to weakest trainer. You may interpret strongest in whatever way you want, but you will have to explain your decision.
  7. */
  8. SELECT p.name, t.trainername, tr.pokelevel, p.primary_type, p.secondary_type
  9. FROM pokemon.pokemons p
  10. JOIN pokemon.pokemon_trainer tr
  11. JOIN pokemon.trainers t ON p.id = tr.pokemon_id AND t.trainerID = tr.trainerID
  12. ORDER BY tr.pokelevel DESC;