A sql lab filled with pokemon data

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --What is each pokemon's primary type?
  2. select types.name, pokemons.name
  3. from pokemon.pokemons
  4. join types on pokemons.primary_type = types.id;
  5. select pokemons.name, types.name
  6. from pokemon.pokemons
  7. join types on pokemons.secondary_type = types.id;
  8. --What is Rufflet's secondary type?
  9. select pokemons.name, types.name
  10. from pokemon.pokemons
  11. join types on pokemons.secondary_type = types.id
  12. where pokemons.name = "Rufflet";
  13. select pokemon_trainer.trainerID
  14. from pokemon.pokemon_trainer
  15. join pokemon.pokemons
  16. select t.name, count(p.name)
  17. from pokemon.pokemons p
  18. join types t
  19. on p.primary_type = t.id
  20. group by t.name;
  21. select *
  22. from pokemon_trainer;
  23. select count(*)
  24. from pokemon.pokemon_trainer;
  25. select count(*) as "number"
  26. from types;
  27. select * from pokemon_trainer
  28. where trainerID = 0 and pokemon_id = 1;
  29. select count(*)
  30. from pokemon_trainer
  31. where pokelevel = 100;