I have a problem with a PostgreSQL query.
I have a table named "pokemons" with different columns :
id | name | pv | attaque | defense | attaque_spe | defense_spe | vitesse | type
----- ------------ ----- --------- --------- ------------- ------------- --------- ------------------
1 | Bulbizarre | 45 | 49 | 49 | 65 | 65 | 45 | {Plante,Poison}
2 | Herbizarre | 60 | 62 | 63 | 80 | 80 | 60 | {Plante,Poison}
3 | Florizarre | 80 | 82 | 83 | 100 | 100 | 80 | {Plante,Poison}
4 | Salameche | 39 | 52 | 43 | 60 | 50 | 65 | {Feu}
5 | Reptincel | 58 | 64 | 58 | 80 | 65 | 80 | {Feu}
6 | Dracaufeu | 78 | 84 | 78 | 109 | 85 | 100 | {Feu,Vol}
7 | Carapuce | 44 | 48 | 65 | 50 | 64 | 43 | {Eau}
8 | Carabaffe | 59 | 63 | 80 | 65 | 80 | 58 | {Eau}
9 | Tortank | 79 | 83 | 100 | 85 | 105 | 78 | {Eau}
In this table, I want to select all the rows with a specific type.
Kind of things, I did try :
SELECT * FROM pokemons WHERE 'feu'=ANY(type);
I tried many things with ALL or stuff like that but can't get a single a row.
Can you help me there please.
Thanks.
CodePudding user response:
Adding to the solution mentioned in the comment, you may also make a case insensitive comparison like this.
SELECT * FROM pokemons WHERE 'feu' ilike ANY(type);