expression BETWEEN min AND max

Description: Returns 1 if expression is greater than or equal to min and less than or equal to max; 0 otherwise.

The comparison is performed according to the following rules:

  • If expression is a TIMESTAMP, DATE, or DATETIME column, min and max are interpreted as the same datatype if they are constants.

  • If expression is a string that is not case-sensitive, the comparison is done in a way that is not case-sensitive.

  • If expression is a string that is case-sensitive, the comparison is done in a case-sensitive way.

  • If expression is evaluated to be an integer, an integer comparison is done.

  • Otherwise, a floating-point comparison is done.

Examples:

  • 10 BETWEEN 12 AND 20 returns 0.

  • 10 BETWEEN '10' AND '20' returns 1.

  • 'a' BETWEEN 'X' AND 'z' returns 0.

  • BINARY 'a' BETWEEN 'X' AND 'z' returns 1.

  • 'a' BETWEEN BINARY 'X' AND 'z' returns 0.

See also: GREATEST(), LEAST()

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.34.39