2025-08-16
交易金额大于10000元的所有交易 
select * from cmb_usr_trx_rcd c1
where c1.trx_amt > 100000
order by
c1.trx_amt desc;
2025-08-16
语文数学英语至少1门超过100分的同学 
select *
from
subject_score s1
where
s1.chinese > 100
or s1.english > 100
or s1.math > 100
order by
s1.chinese;
2025-08-16
查询所有起点或终点为“海底捞西丽店”的行程记录 
select * from didi_sht_rcd d1 where d1.start_loc = '海底捞西丽店' or d1.end_loc = '海底捞西丽店';
2025-08-16
总分超过300分的学生 
select s1.student_id from subject_score s1
where s1.chinese + s1.english + s1.math >= 300
;
2025-08-16
城市平均最高气温 
select
w1.city, cast(avg(w1.tmp_h) as decimal(4, 2)) as avg_tmp_h
from
weather_rcd_china w1
where
year(w1.dt) = '2021'
group by
w1.city
order by
2 desc;
2025-08-16
输出特定日期上市的银行 
select * from stock_info s1
where s1.list_date between '2006-06-01' and '2006-09-01'
and s1.industry ='银行';
2025-08-16
A和K之间的手牌(2) 
select * from hand_permutations h1
where h1.card1 between 'A' and 'K'
or h1.card2 between 'A' and 'K' ;
2025-08-16
A和K之间的手牌(1) 
select * from hand_permutations h1 where h1.card1 between 'A' and 'K' ;
2025-08-16
交易金额在5000至10000(含边界)的所有交易 
select * from cmb_usr_trx_rcd c1
where c1.trx_amt between 5000 and 10000
order by
c1.trx_amt desc
limit 5;
2025-08-16
找出三个班级的女生 
select *
from
students s1
where
s1.class_code in ('C219', 'C220', 'C221')
and
s1.gender = 'f'
order by
s1.student_id;
2025-08-16
找出所有港台歌手 
select * from singer_info s1 where s1.type2 = '港台' order by s1.singer_id;
2025-08-15
特定渠道的中档单价用户 
select * from apple_pchs_rcd a1
where a1.payment_method = 'Apple Pay' and a1.product_price >= 3000 and a1.order_channel = '官网'
order by a1.order_id;
2025-08-15
特定渠道的中档单价用户 
select * from apple_pchs_rcd a1
where a1.payment_method = 'Apple Pay' and a1.product_price >= 3000
order by a1.order_id;
2025-08-15
文科潜力股 
select *
from
scores s1
where
s1.exam_date = '2024-06-30' and
(s1.subject in('历史', '政治', '地理') and s1.score >= 90 )
order by
s1.score desc;
2025-08-15
文科潜力股 
select *
from
scores s1
where
(s1.subject in('历史', '政治', '地理') and s1.score >= 90 )
and
s1.exam_date = '2024-06-30'
order by
s1.score desc;
2025-08-15
文科潜力股 
select *
from
scores s1
where
(s1.subject in('历史', '政治', '地理') and s1.score >= 90 )
and
s1.exam_date = '2024-06-30'
order by
s1.score desc, student_id,subject;
2025-08-15
文科潜力股 
select *
from
scores s1
where
(
(s1.subject ='历史' and s1.score >= 90)
or (s1.subject ='政治' and s1.score >= 90)
or (s1.subject ='地理' and s1.score >= 90)
)
and
s1.exam_date = '2024-06-30'
order by
s1.score desc;
2025-08-15
文科潜力股 
select *
from
scores s1
where
(
(s1.subject = '历史' and s1.score >= 90)
or
(s1.subject = '政治' and s1.score >= 90)
or
(s1.subject = '地理' and s1.score >= 90)
)
and
s1.exam_date = '2024-06-30'
order by
s1.score desc;
2025-08-15
文科潜力股 
select *
from
scores s1
where
s1.exam_date = '2024-06-30'
and
(s1.subject in('历史', '政治', '地理') and s1.score > 90)
order by
s1.score desc;
2025-08-15
给英语成绩中上水平的学生拔尖 
select *
from
scores s1
where
s1.subject = '英语' and s1.exam_date = '2024-06-30' and s1.score between 100 and 110
order by
s1.score desc;