mysql批量修改表名欄位名 列名 為小寫或大寫

2021-09-27 12:55:14 字數 638 閱讀 7658

select

concat( 'alter table ', table_name, 』 change column ', column_name, 』 ', ucase( column_name ), 』 『, column_type, 』 comment 『』, column_comment, 『』;』 ) as 『修改指令碼』

from

information_schema.columns

where

table_schema = 『資料庫名(替換即可)』

select

concat( 'alter table ', table_name, 』 rename to ', lower( table_name ), 『;』 ) as 『修改指令碼』

from

information_schema.tables

where

table_schema = '『資料庫名(替換即可)』

1.執行結果集中的指令碼即可。

2.ucase函式是轉換為大寫

3. lower函式是轉換為小寫(可根據自己要求來)

4. 複製sql後,需要注意中文』 要替換成英文

資料庫修改表名,欄位名 字段型別

修改表 1 修改表的名稱呢 alter table 表名 rename to 新的名字 demo alter table ta1 rename to ta0 2 新增乙個新字段 alter table 表名 add 新字段 欄位的型別 demo alter table ta0 add unames ...

取Oracle 表名 欄位名

檢視oracle 資料庫中本使用者下的所有表 select table name from user tables 檢視oracle 資料庫中所有使用者下的所有表 select user,table name from all tables 檢視oracle 資料庫中本使用者下的所有列 select...

取Oracle 表名 欄位名

取 oracle 表名 欄位名 注釋等實用語句 sql 檢視oracle 資料庫中本使用者下的所有表 select table name from user tables 檢視oracle 資料庫中所有使用者下的所有表 select user,table name from all tables 檢...