当前位置:   article > 正文

mysql查询18至28岁的人,MySQL数据库-数据的条件查询(where) 命令演示

mysql查询年龄小于18的sql语句

条件查询

elect … from 表名 where …

比较运算符

>

查询大于18岁的信息

select * from students where age>18;

select id,name,gender from students where age>18;

<

查询小于18岁的信息

select * from students where age<18;

>= <=

查询小于或等于18岁的信息

=

查询年龄为18岁的所有学生的名字

select * from students where age=18;

!= 或者 <>

逻辑运算符

and

18到28岁之间所有学生的信息

select * from students where age>18 and age<28;

失败select * from students where age>18 and <28;

18岁以上的女性

select * from students where age>18 and gender=“女”;

select * from students where age>18 and gender=2;

or

18岁以上或者身高查过180(包含)以上

select * from students where age>18 and height>=180;

not

不在 18岁以上的女性 这个范围内的信息

select * from stu

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/40130
推荐阅读
相关标签
  

闽ICP备14008679号