2025-01-08
聚合函数-735011学生的语文成绩 
select MAX(score) as max_score,min(score) as min_score,AVG(score) AS avg_score
from scores
where student_id = 735011 and subject = '语文';
2025-01-08
GROUP BY-各科目最高分、最低分 
select subject,MAX(score) as max_score,min(score) as min_score
from scores
group by subject
order by subject ASC
2025-01-08
GROUP BY-各科目平均分 
select subject,AVG(score) as average_score
from scores
where exam_date='2024-06-30'
group by subject
order by subject ASC
2025-01-08
条件过滤-没有职称的老教师 
select name,subject,class_code,enter_date
from teachers
where enter_date < '2010-01-01' and qualification is null
order by enter_date ASC
2025-01-08
条件过滤-没有职称的老教师 
select name,subject,class_code,enter_date
from teachers
where enter_date < '2010-01-01' and qualification is not null
order by enter_date ASC
2025-01-08
条件过滤-没有职称的老教师 
select name,subject,class_code,enter_date
from teachers
where enter_date < '2010-01-01' and qualification is not null
order by enter_date ASC
2025-01-08
GROUP BY-各班级人数 
select class_code,COUNT(student_id) AS student_count
from students
group by class_code
ORDER BY student_count DESC
2025-01-08
GROUP BY-各班级人数 
select class_code,COUNT(student_id) AS student_count
from students
group by class_code
having count(student_id)>10
ORDER BY student_count DESC
2025-01-08
条件过滤-符合条件的班主任 
select name,subject,class_code,qualification
from teachers
where fir_degr IN ('清华大学','北京大学') AND head_teacher is not null
order by name ASC
2025-01-02
用户"kjhd30"的第一笔未完成订单 
select * from didi_order_rcd
where cust_uid ='kjhd30' and finish_time='1970-01-01'
order by call_time
limit 1
2024-12-31
德州扑克起手牌-最强起手牌KK+ 
select * from hand_permutations
where concat(card1,card2) like '%A%A%' or
concat(card1,card2) like '%A%K%' or
concat(card1,card2) like '%K%K%' or
concat(card1,card2) like '%K%A%'
order by id
2024-12-31
特定歌曲的播放记录 
select * from listen_rcd
where date(start_time) between '2023-01-01' and '2023-12-31'
and song_id=13
order by start_time
2024-12-31
查询所有终点是餐饮类地点的行程记录 
SELECT r.*
FROM didi_sht_rcd r
JOIN loc_nm_ctg l ON r.end_loc = l.loc_nm
ORDER BY r.start_tm ASC;
2024-12-31
按照车类统计行程次数 
select car_cls,count(distinct car_cls) as trip_count
from didi_sht_rcd
group by car_cls
order by car_cls DESC
2024-12-31
用户"kjhd30"的第一笔未完成订单 
select
*
from
didi_order_rcd
where
cust_uid = 'kjhd30' and finish_time = '1970-01-01 '
order by
call_time
limit 1
2024-12-31
输出地区为北京的所有银行 
select * from stock_info
where area='北京'
and industry='银行'
order by list_date
2024-12-27
查询所有终点是餐饮类地点的行程记录 
SELECT r.*
FROM didi_sht_rcd r
JOIN loc_nm_ctg b ON r.end_loc = b.loc_nm
ORDER BY r.start_tm ASC
2024-12-27
查询所有终点是餐饮类地点的行程记录 
SELECT r.*
FROM didi_sht_rcd r
JOIN loc_nm_ctg l ON r.end_loc = l.loc_nm
ORDER BY r.start_tm ASC
2024-12-27
查询所有终点是餐饮类地点的行程记录 
SELECT r.*
FROM didi_sht_rcd r
JOIN loc_nm_ctg l ON r.end_loc = l.loc_nm
ORDER BY r.car_cls ASC
2024-12-27
查询所有终点是餐饮类地点的行程记录 
SELECT r.*
FROM didi_sht_rcd r
JOIN loc_nm_ctg l ON r.end_loc = l.loc_nm
ORDER BY r.car_cls desc