操作数据库---查select --distinct --where --between
2022/4/4 19:20:47
本文主要是介绍操作数据库---查select --distinct --where --between,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
查询
-- 别名,给结果起个别名 as 可以给字段起别名,也可以给表起别名 select `studentNO` as学号,`studentName` as学生姓名 from stdent as s; -- 函数concat(a,b) select concat(`姓名`,studentName) as 新名字 from student;
select version() -- 查询系统版本(函数) select 100*3-1 as 计算结果 -- 用来计算(表达式) select @@auto_increment_increment -- 查询自增的步长(变量) select distinct `studentNO` from result -- 数据重复,去重 select `studentNO`,`studentResult`+1 as'提分后' from result -- 学员考试成绩+1分查看 -- 查询成绩在95-100之间 select studentNO,studentResult from result where studentResult>=95 and studentResult<=100; select studentNO,studentResult from result where studentResult between 95 and 100; --模糊查询
逻辑运算符
运算符 | 语法 | 描述 |
---|---|---|
and && | a and b a&&B | 逻辑与,2个都为真,结果才为真 |
or || | a or b a||b | 逻辑或,其中一个为真,就为真 |
not ! | not a !a | 逻辑非,真为假,假为真 |
这篇关于操作数据库---查select --distinct --where --between的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04el-table 开启定时器下,表格的选中状态会消失是什么原因-icode9专业技术文章分享
- 2024-10-03如何安装和初始化飞牛私有云 fnOS?-icode9专业技术文章分享
- 2024-10-03如何安装 App 并连接到飞牛 NAS?-icode9专业技术文章分享
- 2024-10-03如何安装飞牛 TV 并连接到影视服务器?-icode9专业技术文章分享
- 2024-10-03如何在PVE和ESXI上安装飞牛私有云 fnOS?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS安装系统异常情况处理-icode9专业技术文章分享
- 2024-10-03飞牛NAS如何创建存储空间?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS硬盘会自动休眠吗?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS如何安装飞牛影视和创建媒体库?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS如何为家人朋友开通影视账号?-icode9专业技术文章分享