MySQL中带in关键字的集合查询
1、只查询ID为2,4,6的信息
select username from user where id in (2,4,6);

2、除了不查询ID为2,4,6的信息外,其他的信息
select username from user where not id in (2,4,6);

3、查询sex中开头为w的信息
select username,age from user where sex like 'w%';

4、查询address中中间有u的信息,'_'的使用
select username,age from user where address like '_u%';
查询address中含有a的信息
select username,age from user where address like '%a%';


5、按年龄排序
select*from user order by age asc;(升序)
select*from user order by age desc;(j降序)


6、limit的使用
限制查询前5个信息

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
                                阅读量:176
阅读量:26
阅读量:169
阅读量:116
阅读量:163