How can I switch case for each letter in a string with SQL?

前端 未结 4 502
旧时难觅i
旧时难觅i 2021-01-29 11:27

I need to convert this into this using PostgreSQL

dxItw9a4 --> DXiTW9A4

Is there any function or way that is already set?

4条回答
  •  一整个雨季
    2021-01-29 11:51

    You can use the following methods supported by PostreSQL:

    UPPER(string_expression)
    

    Example:

    SELECT
       CONCAT (
          UPPER (first_name),
          UPPER (last_name)
       ) as full_name
    FROM
       staff;
    

    Reference: http://www.postgresqltutorial.com/postgresql-letter-case-functions/

提交回复
热议问题