tags:

views:

2508

answers:

6

I have a MySQL database of keywords that are presently mixed-case. However, I want to convert them all to lowercase. Is there an easy command to do this, either using MySQL or MySQL and PHP?

+2  A: 

SELECT LOWER(foo) AS foo FROM bar

Greg
+9  A: 
UPDATE table SET colname=LOWER(colname);
Paul Dixon
+2  A: 

Did you try looking it up? Google, manual...

http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_lower

mysql> SELECT LOWER('QUADRATICALLY');
        -> 'quadratically'
myplacedk
+3  A: 

Yes, the function is LOWER() or LCASE() (they both do the same thing).

For example:

select LOWER(keyword) from my_table
Jon Grant
A: 

I believe in php you can use

strtolower()

so you could make a php to read all the entries in the table then use that command to print them back as lower case

rodent43
+1  A: 

You can use the functions LOWER() or LCASE().

These can be used both on columns or string literals. e.g.

SELECT LOWER(column_name) FROM table a;

or

SELECT column_name FROM table a where column = LOWER('STRING')

LCASE() can be substituted for LOWER() in both examples.

dmanxiii