MySQL自学day2.多条件查询,区间查询,集合方式查询,排序

多条件 and 查询 条件同时满足

select * from yingxiong where y_sex ='男' and y_age > '30' and y_type = 'adc'
image.png

多条件 or 查询 条件至少满足一个

select * from yingxiong where  y_sex = '女' or y_type = 'adc'
image.png

区间查询

select * from yingxiong  where y_age BETWEEN '18' and '30'

另外集合方式查询 in()表示集合

select * from yingxiong  where y_age in (18,25,30)
image.png

order by xxx asc 排序 (默认为正序排列,升序)

select * from yingxiong order by y_age
image.png

order by xxx desc 降序排列

select * from yingxiong order by y_age desc
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容