MySQL 数据库 模糊查询和聚合函数

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

模糊查询

like 运算符

通配符%——代表0-n个任意字符

- ——代表单个任意字符

注意只有char、varchar、text类型才能使用

例子

select * from student where name like '刘%'

select * from student where name like '%建%'

select * from student where name like '%娟'

聚合函数对数据库中数据进行统计计算并给出结果

sum max/min avg count

例子1.求语文课总成绩

2.求语文课的最高分和最低分

3.求语文课的平均成绩

4.求语文课考试记录条数

select sum(exam) as 语文课总成绩 from exam where subjectID=1;

select max(exam) as 语文课最高分 min(exam) as 语文课最低分 from exam where subjectID=1;

select avg(exam) as 语文课平均分 from exam where subjectID=1;

select count (exam) as 数学成绩记录数 from exam where subjectID=1;

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: mysql数据库