#多表子查询
SELECT * FROM 表名 INNER JOIN () as 别名 on 条件#1/查询成绩表中分数80-100以内的值 BETWEEN 在值和值之间的值
select * FROM score WHERE num between 80 and 100;
#2/不明白count count(字段名)\count(*):总数量
select COUNT(num) FROM score;
#3/运算符: >小于 <大于 =等于 =不等于 + - * / %#4/like “%8%”
# %8%:取关于8的值
# ”%8“:取关于后一位是8的值
# "8%" : 取关于前一位是8的值
select * FROM score WHERE num LIKE "%8";#5/DISTINCT 去重:去除重复的值
select DISTINCT num FROM score;#6/ORDER BY 排序:asc:升序 desc:降序
select * from score ORDER BY num DESC;#7/GROUP BY 分组:把重复的分为一组
SELECT * FROM score GROUP BY student_id;#8/LIMIT 分页 选取第几行的数据,或者第几行到第几行数据
#查询4条随机数字
SELECT * FROM score LIMIT 4;
#查询5条随机数据
SELECT * FROM score LIMIT 1,5;#9/取别名(as)
select * from score sc;#10/and:和/并且 or:或者
#and:满足两方条件
#or:满足一方条件
SELECT * FROM WHERE num>80 or student_id=1;#11/in :包含 not in :不包含
#in 有问题 求分数80-100数据
select * FROM score WHERE num in(80,100);#12/is null :为空 is not null:不为空
#给成绩表内的数据为空 有问题:应该是只给num为空,但是全部为空或则全部不为空
select * FROM score WHERE num is null;