sql 语句总结

mysql :  将一个表的数据插入到newT 中

(newT 表须存在,且结构与select 语句对应的结构同  ,最好不用* 而是具体字段)    

       insert into newT select * from t1 where ...

也可以create table newT select f1,f2 from t1; (select into 的替代方法,mysql 不支持select into )

 

MySQL不支持Select Into

 

 

database table 的备份

mysqldump -uroot -proot -h192.101.111.111  databaseName [tableName]  >a.sql

生成表结构及里面的所有数据

================================

可以用下列语句

source a.sql 重新导入

 

当然导入之前可以修改a.sql 里的内容,如表名,如此可实现备份

 

将数据备份,(不是导出sql 语句,而只导出 其中 的数据)

 

select * into outfile 'c:/out.txt' from tableName where ...;

 

 

对应的导入:

load data local infile 'c:/out.txt'  into table positiondata  fileds terminated by ';' (userid ,username );

 

你可能感兴趣的:(sql,c,mysql,数据备份,table,insert)