Dans la clause WHERE d'une requête, il faut spécifier une condition, c'est-à-dire une expression qui peut être évaluée à VRAI ou à FAUX.
Une condition est généralement composée d'un opérande, d'un opérateur de compariasion puis d'un second opérande, par exemple nom = 'Annie'.
Voici les principaux opérateurs de comparaison :
Ex :
SELECT id FROM etudiants WHERE etablissement_id IN (1, 3);
Par exemple, pour trouver les produits dont le prix est supérieur ou égal à 10 et inférieur ou égal à 15 :
SELECT * FROM produits WHERE prix BETWEEN 10 AND 15;
Ex :
SELECT * FROM pages WHERE commentaire IS NULL;
Par exemple, pour trouver tous les prénoms qui débutent par « Pas » :
SELECT * FROM clients WHERE prenom LIKE 'Pas%';
Ex :
SELECT * FROM clients WHERE prenom GLOB 'Pas*';
« SQL As Understood By SQLite - expression ». SQLite. https://www.sqlite.org/lang_expr.html
« SQLite - Operators ». Tuorials Point. https://www.tutorialspoint.com/sqlite/sqlite_operators.htm
« SQLite BETWEEN ». SQLite Tutorial. http://www.sqlitetutorial.net/sqlite-between/
« SQLite IN ». SQLite Tutorial. http://www.sqlitetutorial.net/sqlite-in/
« SQLite Like: Querying Data Based On Pattern Matching ». SQLite Tutorial. http://www.sqlitetutorial.net/sqlite-like/
« SQLite GLOB ». SQLite Tutorial. http://www.sqlitetutorial.net/sqlite-glob/
▼Publicité