본문 바로가기

MySQL79

leetcode 1965. Employees With Missing Information 1 2 3 4 5 6 7 8 select employee_id from( select employee_id from Employees union all select employee_id from Salaries )t group by employee_id having count(*)=1 order by 1 Colored by Color Scripter cs 2022. 3. 31.
leetcode 1179. Reformat Department Table 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # Write your MySQL query statement below SELECT id, SUM(CASE WHEN month = 'jan' THEN revenue END) AS Jan_Revenue, SUM(CASE WHEN month = 'feb' THEN revenue END) AS Feb_Revenue, SUM(CASE WHEN month = 'mar' THEN revenue END) AS Mar_Revenue, SUM(CASE WHEN month = 'apr' THEN revenue END) AS Apr_Revenue, SUM(CASE WHEN month = 'may' THEN revenue END) AS May_Revenu.. 2022. 3. 31.
leetcode 1407. Top Travellers 1 2 3 4 5 6 # Write your MySQL query statement below select u.name, IFNULL(sum(r.distance), 0) as travelled_distance from Users u left join Rides r on u.id=r.user_id group by r.user_id order by 2 desc, 1 asc Colored by Color Scripter cs 2022. 3. 31.
leetcode 1890. The Latest Login in 2020 1 2 3 4 5 6 7 # Write your MySQL query statement below select user_id, max(time_stamp) as last_stamp from Logins where 1=1 and time_stamp>='2020-01-01' and time_stamp 2022. 3. 30.
leetcode 1484. Group Sold Products By The Date 1 2 3 4 5 6 7 # Write your MySQL query statement below select sell_date, COUNT(DISTINCT product) num_sold, group_concat(DISTINCT product) products from Activities group by sell_date order by sell_date Colored by Color Scripter cs 2022. 3. 30.
Hacker rank Type of Triangle 1 2 3 4 5 6 7 SELECT CASE WHEN A = B AND B = C THEN 'Equilateral' WHEN A >=B+C OR B>=A+C OR C>=A+B THEN 'Not A Triangle' WHEN A = B OR A = C OR B = C THEN 'Isosceles' ELSE 'Scalene' END FROM TRIANGLES Colored by Color Scripter cs 2021. 10. 23.
Hacker rank Average Population of Each Continen 1 2 3 4 select country.continent, truncate (avg(city.population),0) from city join country on city.countrycode=country.code group by country.continent Colored by Color Scripter cs 2021. 10. 23.
Hacker rank Weather Observation Station 17 1 2 3 4 select round(long_w,4) from station where lat_n>38.7780 order by lat_N limit 1 cs 2021. 10. 21.
Hacker rank Weather Observation Station 16 1 2 3 select round(min(lat_n),4) from station where lat_n>38.7780 cs 2021. 10. 21.
Hacker rank Weather Observation Station 15 1 2 3 4 select round (long_w,4) from station where lat_n 2021. 10. 21.
Hacker rank Weather Observation Station 14 1 2 3 select truncate (max(lat_n), 4 ) from station where lat_n 2021. 10. 21.
Hacker rank Weather Observation Station 13 1 2 3 select truncate (sum(lat_n) ,4) from station where lat_n>38.7880 and lat_n 2021. 10. 21.