ram kumar
ram kumar

Reputation: 523

MySql Query to Change a lower case to upper case

How to change all lower cases in a string to upper cases using MySql Query?

Upvotes: 46

Views: 120149

Answers (8)

Ndu Khubone
Ndu Khubone

Reputation: 21

UPDATE TableName SET ColumnName = UPPER(ColumnName)

Upvotes: 2

Ronnie Souza Moraes
Ronnie Souza Moraes

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

Endang Taryana
Endang Taryana

Reputation: 129

You can use this code for change uppercase your query SQL:

UPDATE penduduk SET dusun = UPPER(dusun);

Upvotes: 4

Fahim Hossain
Fahim Hossain

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

Adriaan Stander
Adriaan Stander

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

SQL Fiddle DEMO

Here is an example of changing the table data

Upvotes: 16

xdazz
xdazz

Reputation: 160963

If you want to update:

UPDATE my_table SET my_column = UPPER(my_column)

Upvotes: 76

Soojoo
Soojoo

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

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171579

You can use UPPER for this:

select upper(MyColumn) 
from MyTable

Upvotes: 7

Related Questions