You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT CASE WHEN A + B > C AND A+C>B AND B+C>A THEN CASE WHEN A = B AND B = C THEN 'Equilateral' WHEN A = B OR B = C OR A = C THEN 'Isosceles' WHEN A != B OR B != C OR A != C THEN 'Scalene' END ELSE 'Not A Triangle' END FROM TRIANGLES;
select concat(name,'(',substr(occupation,1,1),')') from occupations order by name;
select concat('There are a total of ',count(*),'',lower(occupation),'s.') from occupations group by occupation order bycount(*), occupation;
SELECT case
when P IS NULL THEN CONCAT(N, ' Root')
when N IN (SELECT DISTINCT P FROM BST) THEN CONCAT(N, ' Inner')
ELSE CONCAT(N, ' Leaf')
END
FROM BST
ORDER BY N ASC
select round(s.lat_n, 4) from station s where (selectcount(lat_n) from station wheres.lat_n> lat_n ) = (selectcount(lat_n) from station wheres.lat_n< lat_n );
select if(g.grade<8, 'NULL', s.name), g.grade, s.marksfrom students as s, grades as g wheres.marks between g.min_markandg.max_markorder byg.gradedesc, s.name;
selecth.hacker_id, name, sum(score) as total_score
from
hackers as h inner join
(select hacker_id, max(score) as score from submissions group by challenge_id, hacker_id) max_score
onh.hacker_id=max_score.hacker_idgroup byh.hacker_id, name
having total_score >0order by total_score desc, h.hacker_id;
selectcon.contest_id,
con.hacker_id,
con.name,
sum(total_submissions),
sum(total_accepted_submissions),
sum(total_views), sum(total_unique_views)
from contests con
join colleges col oncon.contest_id=col.contest_idjoin challenges cha oncol.college_id=cha.college_idleft join
(select challenge_id, sum(total_views) as total_views, sum(total_unique_views) as total_unique_views
from view_stats group by challenge_id) vs oncha.challenge_id=vs.challenge_idleft join
(select challenge_id, sum(total_submissions) as total_submissions, sum(total_accepted_submissions) as total_accepted_submissions from submission_stats group by challenge_id) ss oncha.challenge_id=ss.challenge_idgroup bycon.contest_id, con.hacker_id, con.namehavingsum(total_submissions)!=0orsum(total_accepted_submissions)!=0orsum(total_views)!=0orsum(total_unique_views)!=0order by contest_id;
select
submission_date ,
( SELECTCOUNT(distinct hacker_id)
FROM Submissions s2
WHEREs2.submission_date=s1.submission_dateAND (SELECTCOUNT(distinct s3.submission_date) FROM Submissions s3 WHEREs3.hacker_id=s2.hacker_idANDs3.submission_date<s1.submission_date) = dateDIFF(s1.submission_date , '2016-03-01')) ,
(select hacker_id from submissions s2 wheres2.submission_date=s1.submission_dategroup by hacker_id order bycount(submission_id) desc , hacker_id limit1) as shit,
(select name from hackers where hacker_id = shit)
from
(select distinct submission_date from submissions) s1
group by submission_date
SET sql_mode ='';
SELECT Start_Date, End_Date
FROM
(SELECT Start_Date FROM Projects WHERE Start_Date NOT IN (SELECT End_Date FROM Projects)) a,
(SELECT End_Date FROM Projects WHERE End_Date NOT IN (SELECT Start_Date FROM Projects)) b
WHERE Start_Date < End_Date
GROUP BY Start_Date
ORDER BY DATEDIFF(End_Date, Start_Date), Start_Date