between operator in oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hiral amit patel
    New Member
    • Jul 2009
    • 5

    between operator in oracle

    when i am searching the names in range with following query

    select * from salesman where name between 'a%' and 'c%';

    it does not display the names starting from c; it displays the name which starts from a and b. why it is so?
    Last edited by Frinavale; Jul 17 '09, 03:24 PM. Reason: Moved to Oracle Answers
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Try this query:

    [code=oracle]

    select * from salesman where name LIKE 'a%' OR name LIKE 'c%';

    [/code]

    Comment

    • hiral amit patel
      New Member
      • Jul 2009
      • 5

      #3
      I want to search the names whose intial starts from a to c
      with your answer i can find only those names which starts from a or b

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        oops, silly mistake.here is the query:

        [code=oracle]

        select * from salesman where UPPER(SUBSTR(na me,1,1)) between 'A' and 'C';

        [/code]

        Comment

        Working...