Oracle - Select where field has lowercase characters

前端 未结 6 2057
悲&欢浪女
悲&欢浪女 2021-02-12 13:32

I have a table, users, in an Oracle 9.2.0.6 database. Two of the fields are varchar - last_name and first_name.

When rows are inserted into this table, the first name a

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-12 14:00

    I think BQ's SQL and Justin's second SQL will work, because in this scenario:

    first_name        last_name
    ----------        ---------
    bob               johnson
    Bob               Johnson
    BOB               JOHNSON
    

    I want my query to return the first 2 rows.

    I just want to make sure that this will be an efficient query though - my table has 500 million rows in it.

    When you say upper(first_name) != first_name, is "first_name" always pertaining to the current row that oracle is looking at? I was afraid to use this method at first because I was afraid I would end up joining this table to itself, but they way you both wrote the SQL it appears that the equality check is only operating on a row-by-row basis, which would work for me.

提交回复
热议问题