1234567891011121314151617181920212223 |
- #Part 2: Simple Selects and Counts
-
- # What are all the types of pokemon that a pokemon can have?
- SELECT name
- FROM types;
- #What is the name of the pokemon with the id 45?
- SELECT name
- FROM pokemons
- WHERE id = 45;
-
- #How many pokemon are there?
- SELECT MAX(id)
- FROM pokemons;
-
- #How many types are there?
- SELECT COUNT(name)
- FROM types;
-
- #How many pokemon have a secondary type?
- SELECT COUNT(name)
- FROM pokemons
- WHERE secondary_type IS NOT NULL;
|