MySQL MySql查询将小写更改为大写

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12652444/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:02:16  来源:igfitidea点击:

MySql Query to Change a lower case to upper case

mysqlsqlstring

提问by ram kumar

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

如何使用 MySql Query 将字符串中的所有小写字母更改为大写字母?

回答by xdazz

If you want to update:

如果要更新:

UPDATE my_table SET my_column = UPPER(my_column)

回答by Adriaan Stander

Have a look at using UPPER

看看使用UPPER

Returns the string str with all characters changed to uppercase according to the current character set mapping.

根据当前字符集映射,返回所有字符都变为大写的字符串 str。

From the LINK

来自链接

UCASE() is a synonym for UPPER().

UCASE() 是 UPPER() 的同义词。

Have a look at this example

看看这个例子

SQL Fiddle DEMO

SQL小提琴演示

Here is an example of changing the table data

这是更改表数据的示例

回答by Sujathan R

Use upper() or UCASE()

使用 upper() 或 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)

回答by RedFilter

You can use UPPERfor this:

您可以UPPER为此使用:

select upper(MyColumn) 
from MyTable

回答by Endang Taryana

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

您可以使用此代码更改查询 SQL 的大写:

UPDATE penduduk SET dusun = UPPER(dusun);

回答by Fahim Hossain

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 Workbenchand have safe updateson then try:

如果您使用的是MYSQL Workbench并且有安全更新,请尝试:

update table_name
set column_name = BINARY UPPER(column_name)
WHERE  column_name = BINARY LOWER(column_name)

回答by Ronnie Souza Moraes

If you are using phpMyAdmin goes to SQL then type

如果您使用的是 phpMyAdmin,请转到 SQL,然后键入

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

PS:如果您是学习者,请遵循此TIP

Before you type the tablename, you need to type this sign `before and after, as well as when you type the column name.

在你输入之前tablename,你需要在之前和之后输入这个符号`,以及在你输入列名的时候。