转,mysql的select * into
關(guān)于MySQL select into 和 SQLServer select into
一.MySQL不支持Select Into語句直接備份表結(jié)構(gòu)和數(shù)據(jù),由于工作中的需要在網(wǎng)上找到一種方法可以代替, 也有其它方法可以處理,總結(jié)如下:
方法1:
???? MYSQL不支持:
??????? Select * Into new_table_name from old_table_name;
???? 替代方法:
??????? Create table new_table_name (Select * from old_table_name);
方法2:
???? 1.先備份表結(jié)構(gòu)和數(shù)據(jù)
#導(dǎo)出命令 -u用戶名 -p密碼 -h主機(jī)IP地址 數(shù)據(jù)庫名 表名1?? > 導(dǎo)出文件.sql
mysqldump -uroot -proot -h192.168.0.88 ok_db oktable2 > ok_db.sql
???? 2.修改備份表的名字
???? 3.登錄MySQL
???? 4.選擇數(shù)據(jù)庫
???? 5.執(zhí)行: Source 備份表的路徑 如:Source d:/ok_db.sql 回車即可。
???? 6.完成.
二. SQLServer支持 Select into語句
?? 1.備份表直接執(zhí)行如下就可以了。
????? Select * Into new_table_name from old_table_name;
三. MySQL Select into outfile用于導(dǎo)出指定的查詢數(shù)據(jù)到文件如下:
1.導(dǎo)出表中所有數(shù)據(jù)到C盤根目錄outfile.txt中如下:
???? Select * into outfile 'c://outfile.txt' from test;
??
2.導(dǎo)出表中指定查詢條件2005-06-08號(hào)的數(shù)據(jù)到C盤根目錄outfile1.txt中如下:
???? Select * into outfile 'c://outfile.txt' from test where beginDate='2008-06-08';
轉(zhuǎn)載于:https://www.cnblogs.com/sanpoye/archive/2011/05/11/2659649.html
總結(jié)
以上是生活随笔為你收集整理的转,mysql的select * into的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU 1063 Exponentiat
- 下一篇: mysql慢查询日志 Mysql慢查询