首页 > 其他 > 详细

通配符

时间:2021-04-12 12:14:39      阅读:18      评论:0      收藏:0      [点我收藏+]

##(2.3)查询学号是S_1001,S_1002,S_1003的记录


写法一:select * from stu where sid = ‘S_1001‘ or sid = ‘S_1002‘ or sid = ‘S_1003‘;
写法二:select * from stu where sid in (‘S_1001‘, ‘S_1002‘, ‘S_1003‘);


##(2.3)查询学号不是S_1001,S_1001,S_1002,S_1003的记录
select * from stu where sid not in (‘S_1001‘, ‘S_1002‘, ‘S_1003‘);

##(2.4)查询年龄为null的记录
select * from stu where sname is not null;

##(2.5)查询年龄为20-40之间的
方式一:select * from stu where age >=20 and age <=40;
方式二:select * from stu where age between 20 and <= 40;错误


##(2.6)查询性别:非男 学生记录
select * from stu where gender != ‘male‘;
select * from stu where gender <> ‘male‘;
select * from stu where not gender = ‘male‘;


##(2.7)查询名字不为空的学生信息
select * from stu where sname is not null;


##通配符
##查询名字有五个字母构成的 学生记录
select * from stu where sname like ‘______‘;

通配符

原文:https://www.cnblogs.com/zsrr/p/14646490.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!