Reputation: 523
How to change all lower cases in a string to upper cases using MySql Query?
Upvotes: 46
Views: 120149
Reputation: 11
If you are using phpMyAdmin goes to SQL then type
UPDATE `tableName` SET `ColumnName`=UPPER(`ColumnName`)
Eg:
UPDATE`cars` SET `Model`=UPPER(`Model`)
then save it.
PS: If you are a learner, follow this TIP
Before you type the tablename
, you need to type this sign ` before and after, as well as when you type the column name.
Upvotes: 1
Reputation: 129
You can use this code for change uppercase your query SQL:
UPDATE penduduk SET dusun = UPPER(dusun);
Upvotes: 4
Reputation: 1698
For column updates on a table, it may depend on if your collation is case insensitive. If that is the case then try using Binary comparison:
update table_name
set column_name = BINARY UPPER(column_name)
Otherwise this should work,
update table_name
set column_name = UPPER(column_name)
If you are using MYSQL Workbench and have safe updates on then try:
update table_name
set column_name = BINARY UPPER(column_name)
WHERE column_name = BINARY LOWER(column_name)
Upvotes: 4
Reputation: 166606
Have a look at using UPPER
Returns the string str with all characters changed to uppercase according to the current character set mapping.
From the LINK
UCASE() is a synonym for UPPER().
Have a look at this example
Here is an example of changing the table data
Upvotes: 16
Reputation: 160963
If you want to update:
UPDATE my_table SET my_column = UPPER(my_column)
Upvotes: 76
Reputation: 2166
Use upper() or UCASE()
Example:
SELECT UCASE(columnName) FROM `table_name`
SELECT UPPER(columnName) FROM `table_name`
Updation
UPDATE table_name SET field_name = UPPER(field_name)
UPDATE table_name SET field_name = UCASE(field_name)
Upvotes: 9
Reputation: 171579
You can use UPPER
for this:
select upper(MyColumn)
from MyTable
Upvotes: 7