SELECT *
FROM numbers_for_fun
WHERE
(a = 0 AND (
(b = 0 AND c < 0)
OR (b != 0 AND (
(b > 0 AND c < 0)
OR (b < 0)
))
))
OR
(a != 0 AND (
(a > 0 AND (c < 0 OR (b < 0 AND 4*a*c < b*b)))
OR
(a < 0)
));
select * from numbers_for_fun
where (a=0 and (b>0 and c<0) or (b=0 and c>0) or (b<0)) or (a != 0 AND ((a > 0 AND (c < 0 OR (b < 0 AND 4*a*c < b*b)))
OR
(a < 0)
))
with past as (
select usr_id,login_time from user_login_log
where datediff(current_date,login_time)<=180
order by usr_id
),
date as (
select usr_id,date(login_time) login_date from past
),
day as (
select usr_id,count(distinct login_date) login_days from date
group by usr_id
)
select
SUM(CASE WHEN login_days BETWEEN 1 AND 5 THEN 1 ELSE 0 END) AS days_1_to_5,
SUM(CASE WHEN login_days BETWEEN 6 AND 10 THEN 1 ELSE 0 END) AS days_6_to_10,
SUM(CASE WHEN login_days BETWEEN 11 AND 20 THEN 1 ELSE 0 END) AS days_11_to_20,
SUM(CASE WHEN login_days > 20 THEN 1 ELSE 0 END) AS days_over_20
from day
select * from scores
where exam_date='2024-06-30' and ((subject='历史' and score>=90) or (subject='政治' and score>=90) or (subject='地理' and score>=90))
order by score desc,student_id,subject
select * from scores
where exam_date='2024-06-30' and ((subject='历史' and score>=90) or (subject='政治' and score>=90) or (subject='政治' and score>=90))
order by score desc,student_id,subject
select * from scores
where exam_date='2024-06-30' and ((subject='历史' or score>=90) or (subject='政治' or score>=90) or (subject='政治' or score>=90))
order by score desc,student_id,subject
select * from scores
where exam_date='2024-06-30' and ((subject='历史' or score>=90) and (subject='政治' or score>=90) and (subject='政治' or score>=90))
order by score desc,student_id,subject
select sum(case when right(card1,1)=right(card2,1) then 1 else 0 end)/2 cnt,count(*)/2 ttl_cnt,cast((sum(case when right(card1,1)=right(card2,1) then 1 else 0 end))/(count(*)) as decimal(4,3)) p from hand_permutations
select sum(case when right(card1,1)=right(card2,1) then 1 else 0 end)/2 cnt,round(count(*)/2,0) ttl_cnt,cast((sum(case when right(card1,1)=right(card2,1) then 1 else 0 end))/(count(*)) as decimal(4,3)) p from hand_permutations