#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,781
    Rep Power
    172

    WHERE column BETWEEN 'd' AND 'f'


    Does this mean find all items where their name startes with d, e or f?
    Code:
    SELECT name
    FROM   `items`
    WHERE  name BETWEEN 'd' AND 'f'
    If so is it really the best solution?
  2. #2
  3. Nosey Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,607
    Rep Power
    9417
    No, it means to find items where the name sorts between the strings "d" and "f". That includes "e", "d" and "f" (because BETWEEN is inclusive), "demographic", and "elliptical", but it does not include "fluoride" (because it sorts after "f").

    Additionally, if you're using a case-sensitive collation (which you can tell by checking if the collation is binary or its name ends in "cs") it will not include "Demographic".


    You can
    Code:
    WHERE name >= 'd' AND name < 'g'

IMN logo majestic logo threadwatch logo seochat tools logo