BETWEEN AND
Sintassi
expr BETWEEN min AND max
Spiegazione
Se expr è maggiore o uguale a min ed expr è minore o uguale a max, BETWEEN restituisce 1, altrimenti restituisce 0. Ciò equivale all'espressione (min <= expr AND expr <= max) se tutti gli argomenti sono dello stesso tipo. Altrimenti avviene una conversione tra tipi come spiegato alla pagina Type Conversion, ma applicata a tutti e tre gli argomenti.
Esempi
MariaDB [(none)]> SELECT 1 BETWEEN 2 AND 3; +-------------------+ | 1 BETWEEN 2 AND 3 | +-------------------+ | 0 | +-------------------+
MariaDB [(none)]> SELECT 'b' BETWEEN 'a' AND 'c'; +-------------------------+ | 'b' BETWEEN 'a' AND 'c' | +-------------------------+ | 1 | +-------------------------+
MariaDB [(none)]> SELECT 2 BETWEEN 2 AND '3'; +---------------------+ | 2 BETWEEN 2 AND '3' | +---------------------+ | 1 | +---------------------+
MariaDB [(none)]> SELECT 2 BETWEEN 2 AND 'x-3'; +-----------------------+ | 2 BETWEEN 2 AND 'x-3' | +-----------------------+ | 0 | +-----------------------+ 1 row in set, 1 warning (0.00 sec) Warning (Code 1292): Truncated incorrect DOUBLE value: 'x-3'
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.