Between Clause

  • chgn01

    Hall of Fame

    Points: 3537

    Comments posted to this topic are about the item Between Clause

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

  • Danny Ocean

    SSCertifiable

    Points: 6098

    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 !!!

  • kapil_kk

    SSC-Insane

    Points: 21316

    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/

  • Neeraj Prasad Sharma

    Ten Centuries

    Points: 1285

    thanks for the question 1+

    Neeraj Prasad Sharma
    Sql Server Tutorials

  • amit_adarsh

    Ten Centuries

    Points: 1273

    why Doug is not in the list.

  • Lokesh Vij

    SSChampion

    Points: 10836

    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

  • paul s-306273

    SSChampion

    Points: 10602

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

  • batgirl

    SSCarpal Tunnel

    Points: 4979

    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).

  • JAZZ Master

    Hall of Fame

    Points: 3292

    Interesting question.

  • Koen Verbeeck

    SSC Guru

    Points: 258955

    Nice one, thanks!

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

  • Lon-860191

    SSCrazy

    Points: 2449

    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.

  • srienstr

    SSCrazy

    Points: 2335

    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.

  • Revenant

    SSC-Forever

    Points: 42467

    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!

  • rudy.escoto

    SSC Rookie

    Points: 35

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

    Letter D preceeds Dough.

  • zymos

    SSCommitted

    Points: 1960

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

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

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