常用查询及连接查询的使用select * from student where id=1;
1条回答 默认 最新
关注 (一)条件查询 where
1.等值查询 =select * from student where id=1;
2.不等值查询 != (< >)
查询年龄不是20岁的学生信息
select * from student where age!=20;
3.关系比较查询 < <= > >=
查询年龄大于20岁的学生信息
select * from student where age>20;
4.逻辑运算查询 and or
and 满足所有条件 or只需要满足其中一个条件
查询年龄小于21岁并且住址是郑州
select * from student where age<21 and address="郑州";
查询年龄小于21岁或者住址是郑州的
select * from student where age<21 or address="郑州";
5.区间查询 between .. and (包含边界值)
查询年龄是18岁到21岁之间
select * from student where age between 18 and 21;
select * from student where age>=18 and age<=21;
6.模糊查询 like
① %(匹配0-n个字符)
查询学生表中名字包含x的学生信息
select * from student where stuname like '%x%';
② _ (匹配一个字符,相当于一个占位符)
查询学生表中地址第二个字为京的信息
select * from student where adderss like '_京';
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥20 微信小程序 canvas 问题
- ¥15 系统 24h2 专业工作站版,浏览文件夹的图库,视频,图片之类的怎样删除?
- ¥15 怎么把512还原为520格式
- ¥15 MATLAB的动态模态分解出现错误,以CFX非定常模拟结果为快照
- ¥15 求高通平台Softsim调试经验
- ¥15 canal如何实现将mysql多张表(月表)采集入库到目标表中(一张表)?
- ¥15 wpf ScrollViewer实现冻结左侧宽度w范围内的视图
- ¥15 栅极驱动低侧烧毁MOSFET
- ¥30 写segy数据时出错3
- ¥100 linux下qt运行QCefView demo报错