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