Between Clause

  • Comments posted to this topic are about the item Between Clause

    --------------------------------------
    ;-)“Everything has beauty, but not everyone sees it.” ― Confucius

  • I never used between for string operation. I also never seen this kind of condition in working scenario.

    :doze:

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!

  • Danny Ocean (6/26/2013)


    I never used between for string operation. I also never seen this kind of condition in working scenario.

    :doze:

    Same here...

    I dont think there is any need of using BETWEEN with aplabets 😎

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • thanks for the question 1+

    Neeraj Prasad Sharma
    Sql Server Tutorials

  • why Doug is not in the list.

  • amit_adarsh (6/27/2013)


    why Doug is not in the list.

    If I pick the names and sort them in ascending order in excel sheet, I will get below

    B.

    Bob

    Carl

    D

    D.

    Doug

    Now as the WHERE clause is "between 'B' and 'D'", it is clear I will only have top 4 values from the above list 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Answer makes sense, but plenty of people were fooled...

  • Danny Ocean (6/26/2013)


    I never used between for string operation. I also never seen this kind of condition in working scenario.

    :doze:

    I agree that it probably doesn't happen with string data so much, but it does help to make clear that the "between" operator works like >= and <= instead of > and < (I have seen many be fooled this way).

  • Interesting question.

  • Nice one, thanks!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I'm not sure that the case sensitive had any place other than to potentially mislead. The result, given the data, is the same so CI vs CS if Carl had been carl then it would matter.

  • Working with health data, we have a lot of code ranges that we deal with for reporting from varchar fields. I have only very rarely seen between used incorrectly, but I have needed to give exactly this clarification a few times.


    Puto me cogitare, ergo puto me esse.
    I think that I think, therefore I think that I am.

  • I am dealing with BETWEEN often, but this was the first time I have seen it for strings. Wow - never thought of that.

    Thanks, Gary!

  • Dough is outside the parameters of "where name between 'B' and 'D' "

    Letter D preceeds Dough.

  • I found the question pretty interesting question on how the solution was easily fulfilled. Thanks.

Viewing 15 posts - 1 through 15 (of 25 total)

You must be logged in to reply to this topic. Login to reply