Home > Database > Mysql Tutorial > How to change table name to uppercase in mysql

How to change table name to uppercase in mysql

藏色散人
Release: 2023-02-16 09:52:47
Original
4094 people have browsed it

Mysql method to change the table name to uppercase: 1. Open the command window; 2. Execute "SELECT concat('alter table ', TABLE_NAME , ' rename to ' , uppe(TABLE_NAME) ,' ;' ) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'xxx';" command can change the table name to uppercase.

How to change table name to uppercase in mysql

The operating environment of this tutorial: Windows 10 system, MySQL version 5.7, Dell G3 computer.

mysql How to change the table name to uppercase?

mysql converts some table names into uppercase letters

1. Execute the following command (wen51 is the name of your database, you only need to change it here, no other changes are needed) to get the uppercase converted SQL statement of all table names in this database.

SELECT
 concat('alter table ', TABLE_NAME , ' rename to ' , upper(TABLE_NAME) ,' ;' ) 
FROM information_schema.TABLES 
WHERE  TABLE_SCHEMA = 'wen51';
Copy after login

How to change table name to uppercase in mysql

2. Copy the SQL statement of the table name that you need to change to uppercase from "Result 1" and execute it together.

How to change table name to uppercase in mysql

3. Pitfall Diary

alter table 原表名 rename to 新表名;
Copy after login

For example:

alter table sys_area rename to sys_area1;
Copy after login

There is no error in execution!
but! ! !

ALTER TABLE act_app_deployment RENAME TO UPPER('act_app_deployment');
Copy after login

will always report error 1064! ! !
UPPER function usage:
How to change table name to uppercase in mysql

Simply put: UPPER must be used after SELECT, it is only used to display results! ! !

Recommended learning: "MySQL Video Tutorial"

The above is the detailed content of How to change table name to uppercase in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template