Select ALL fields that contains only UPPERCASE letters

前端 未结 8 1572
忘了有多久
忘了有多久 2020-12-06 09:16

How do you select a field that contains only uppercase character in mysql or a field that doesn\'t contain any lower case character?

相关标签:
8条回答
  • 2020-12-06 10:16
    SELECT * FROM table1 WHERE (columnname COLLATE latin1_bin )=UPPER(depart);
    
    0 讨论(0)
  • 2020-12-06 10:19

    Found this in the comments - it deserves a post of its own:

    SELECT * FROM mytable WHERE BINARY mycolumn = BINARY UPPER(mycolumn);
    

    The problem with WHERE UPPER(mycolumn) = mycolumn is the collation, and it depends on your table what you can use there.

    0 讨论(0)
提交回复
热议问题