首页 > 代码库 > MySql实用小技巧

MySql实用小技巧

  1. 1:将txt中的数据导入数据库表中,命令:
  2. load data local infile ‘D:\\文件名.txt‘ into table 表名 fields terminated by ‘\t‘;
 
2:插入数据后查询显示乱码,解决方案: set character set_results=utf-8;
 
3:多表多外键数据查询
select * from userinfo,usertype,usercert where userinfo.certid=usercert.certid and userinfo.typeid=usertype.typeid limit ?,?;
 
select * from userinfo,usertype,usercert where userinfo.certid=usercert.certid and userinfo.typeid=usertype.typeid and userinfo.userid=140950223 and password=55555 limit ?,?;

MySql实用小技巧