当前位置:网站首页>C#语言和SQL Server数据库技术
C#语言和SQL Server数据库技术
2022-07-25 09:16:00 【yushang_zhang】
模糊查询和聚合函数查询
一、用like进行模糊查询
1.like:像.......一样
2.用like可以进行模糊查询
3.模糊查询通配符
下划线_ 匹配一个字符
% 匹配任意长度的字符
[ ] 指定范围内的一个字符,[1-8] [a-z] [A-Z] [斤,包]
[^] 不在制定范围内的任意一个字符
二、在范围内查询
1.使用between.....and
a、between 20 and 30
b、between '1991-01-02' and '1992-03-05'
c、可以设置数值区间,也可以设置日期区间
d、包含开始,也包含结束
e、可以通过not between....and来设置取反操作
2.使用in查询有限范围内的数据
a、in(22,33,44)
b、in('aa','bb','cc')
c、not in(22,33,44)
三、聚合函数
1.聚合函数的作用主要是用于统计查询
2.聚合函数只返回一个数值,因此不能够直接与返回多行的列一起显示
3.sum()
4.avg()求平均值,空值会被忽略,例如:求及格学生的平均分
5.max()/ min()求最大最小值,可用于求最高分最低分
6.count()统计个数,会忽略空值,可以通过统计主键列或者count(*)实现
7.一个sql查询中可以使用多个聚合函数,例如查询班级的最高分和最低分
边栏推荐
- A picture to quickly understand envoyfilter in istio
- Shell脚本
- @Scheduled源码解析
- Silicon Valley classroom lesson 15 - Tencent cloud deployment
- LabVIEW experiment - temperature detection system (experimental learning version)
- 为什么说DAO是未来的公司形式
- 音乐人的 NFT 指南
- [C language] dynamic memory management, flexible array
- 『怎么用』代理模式
- Silicon Valley classroom lesson 12 - official account on demand course and live broadcast management module
猜你喜欢

为什么说DAO是未来的公司形式

Arrange the array into the smallest number
![[machine learning] Finally, the important steps of machine learning modeling have been clarified](/img/75/07767ed694502f0c910d35e1447499.jpg)
[machine learning] Finally, the important steps of machine learning modeling have been clarified

Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!

nacos2.1.0集群搭建

What is steel grating?

js触屏小游戏源码冰雪之旅

How to avoid duplicate data when the database is high and distributed

Druid 查询超时配置的探究 → DataSource 和 JdbcTemplate 的 queryTimeout 到底谁生效?

The simplest sklearn environment configuration tutorial in the whole network (100% success)
随机推荐
activemq--可持久化机制之JDBC的journal
ActiveMQ -- persistent mechanism
Shell script
[STL]list模拟实现
How to avoid duplicate data when the database is high and distributed
Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!
The annualization of financial products is 4%. How much profit can you get from buying 10000 yuan a month?
Wechat applet obtains the data of ---- onenet and controls the on-board LED of STM32
音乐人的 NFT 指南
The garbage classification data set used in the excellent Yolo target detection training is shared - about 3000 labeled
【线程知识点】-- 自旋锁
Redis-哨兵,主从部署详细篇
全网最简约的sklearn环境配置教程(百分百成功)
How does Youxuan database encrypt data?
How to connect tdengine with idea database tool?
activemq--延迟投递和定时投递
Activemq-- asynchronous delivery
ActiveMQ -- JDBC code of persistent mechanism
Table table expansion internal row switching effect
JS small game source code magic tower breakthrough Download