1.导出一个数据表中的部分字段数据;
SELECT `lUin` , `iSumMoney` , `iAreaId` FROM tbtest INTO OUTFILE ‘C:/Users/Administrator/Desktop/test/123.xlsx‘
2.导入数据到一个表的相应字段中;
LOAD DATA INFILE ‘data.txt‘ INTO TABLE db2.gs_table;
LOAD DATA INFILE ‘data.txt‘ INTO TABLE table2 FIELDS TERMINATED BY ‘,‘;
3.根据iUin的总的money来进行排序;
select lUin,sum(iSumMoney) as ‘iSumScore‘ from tbUserMoneyTotal group by lUin order by iSumScore desc,lUin asc ;
4.显示一个表的结构信息;
show create table tbname;
5.同一个数据库中拷贝一个表中的部分字段数据到另外一个表中;
INSERT INTO 目标表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM 来源表;