資料庫有一些相似的表,如table1、table2、table3,但是不連續(需要判斷表存不存在),需要為這些表增加一些相同的欄位,有什么簡便的方法嗎
uj5u.com熱心網友回復:
在information_schema.tables拿出表名 用concat拼成陳述句uj5u.com熱心網友回復:
執行類似這樣的拼修改 sql 陳述句的查詢,然后 copy 查詢結果執行select group_concat(';', 'alter table ', table_schema, '.', table_name, ' add column xxx') from information_schema.tables where table_schema='庫名' and table_name like 'table%';
uj5u.com熱心網友回復:
如果熟悉命令列的話,可以用管道mysql -e "拼修改 sql 的查詢" --skip-column-names | mysql 庫名
uj5u.com熱心網友回復:
結帖率:0%
當您的問題得到解答后請及時結貼.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html
8、如何給分和結貼?
http://bbs.csdn.net/help#post_dispose
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/112379.html
標籤:MySQL
