string comparisons with case

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ike

    string comparisons with case

    If I have a field, `lastname`, and in the WHERE predicate of my SELECT
    statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
    I want it to be true if it is smith or Smith or SMITH) how can I specify
    this? Thanks, Ike


  • strawberry

    #2
    Re: string comparisons with case


    Ike wrote:
    If I have a field, `lastname`, and in the WHERE predicate of my SELECT
    statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
    I want it to be true if it is smith or Smith or SMITH) how can I specify
    this? Thanks, Ike
    look at BINARY

    Comment

    • davie

      #3
      Re: string comparisons with case


      By default, MySQL searches are not case sensitive . This means that if
      you search with col_name LIKE 's%', you get all column values that
      start with S or s.

      If you want a column always to be treated in case-sensitive fashion,
      declare it with a case sensitive or binary collation.

      Ike wrote:
      If I have a field, `lastname`, and in the WHERE predicate of my SELECT
      statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
      I want it to be true if it is smith or Smith or SMITH) how can I specify
      this? Thanks, Ike

      Comment

      • Ike

        #4
        Re: string comparisons with case


        "davie" <daviestrachan@ yahoo.co.ukwrot e in message
        news:1160010764 .149933.319800@ m73g2000cwd.goo glegroups.com.. .
        >
        By default, MySQL searches are not case sensitive . This means that if
        you search with col_name LIKE 's%', you get all column values that
        start with S or s.

        But is that true with version >= 5.0 ?


        Comment

        • davie

          #5
          Re: string comparisons with case

          RTFM

          Ike wrote:
          "davie" <daviestrachan@ yahoo.co.ukwrot e in message
          news:1160010764 .149933.319800@ m73g2000cwd.goo glegroups.com.. .

          By default, MySQL searches are not case sensitive . This means that if
          you search with col_name LIKE 's%', you get all column values that
          start with S or s.
          >
          >
          But is that true with version >= 5.0 ?

          Comment

          Working...