views:

117

answers:

2

When working with MySQL, how can I fetch all rows where the name column is all uppercase?

Since equality is case insensitive, I'm not quite sure how to do this.

+4  A: 

If your column collation is case insensitive, you can override it in your query:

SELECT * FROM my_table WHERE my_column COLLATE latin1_bin = UPPER(my_column);

COLLATE clause syntax.

ChssPly76
+1  A: 

SELECT * FROM my_table REGEXP '^[[:upper:]]+$';

longneck