코테준비 | Top earners/Weather Observation Station 13~18(+해커랭크 SQL 모든 문제 해결 완료)
·
SQL
☑️  Top Earners[문제]Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as  space-separated integers.직원의 가장 높은 총 수입과 해당 수입을 받는 직원 수집계두 출력값은 스페이스 두개로 연결[문제 풀이]내 코드 SELECT CONCAT(max(months*salary),' ',count(DISTINCT employee_id))FROM EMPLOYEEWHERE months*salary IN (SELECT max(months*sa..
코테준비 | 15 Days of Learning SQL (+해커랭크 고 난이도, where 절 연관 서브쿼리 활용)
·
SQL
15 Days of Learning SQL | HackerRankfind users who submitted a query every day.www.hackerrank.com☑️  15 Days of Learning SQL[문제]Julia conducted a  days of learning SQL contest. The start date of the contest was March 01, 2016 and the end date was March 15, 2016.Write a query to print total number of unique hackers who made at least  submission each day (starting on the first day of the contest),..
코테 준비 | Draw The Triangle 1/Draw The Triangle 2 (SET @ / REPEAT)
·
SQL
Draw The Triangle 1 | HackerRankDraw the triangle pattern using asterisks.www.hackerrank.com☑️  Draw The Triangle 1[문제]'*' 특수문자 반복하여 직각 삼각형 구현하는 문제[문제 풀이]내 코드 SELECT REPEAT('* ',20) UNION ALL SELECT REPEAT('* ',19) UNION ALL SELECT REPEAT('* ',18) UNION ALL SELECT REPEAT('* ',17) UNION ALL SELECT REPEAT('* ',16) UNION ALL SELECT REPEAT('* ',15) UNION ALL SELECT REPEAT('* ',14)UNION ALL SELECT RE..
코테준비 | 해커랭크 interviews (다중 테이블 join)
·
SQL
Interviews | HackerRankfind total number of view, total number of unique views, total number of submissions and total number of accepted submissions.www.hackerrank.com☑️  interviews[문제]Samantha interviews many candidates from different colleges using coding challenges and contests. Write a query to print the contest_id, hacker_id, name, and the sums of total_submissions, total_accepted_submissio..
코테준비 | 해커랭크 SQL Project Planning / Placements (연속된 그룹 필터링/다중 JOIN)
·
SQL
SQL Project Planning | HackerRankWrite a query to output the start and end dates of projects listed by the number of days it took to complete the project in ascending order.www.hackerrank.com  Placements | HackerRankWrite a query to output the names of those students whose best friends got offered a higher salary than them.www.hackerrank.com ☑️  SQL Project Planning[문제]If the End_Date of the tas..
코테준비 | hackerrank - Challenges (다중컬럼 서브쿼리,CTE)
·
SQL
Challenges | HackerRankPrint the total number of challenges created by hackers.www.hackerrank.com☑️  Challenges[문제]Julia asked her students to create some coding challenges. Write a query to print the hacker_id, name, and the total number of challenges created by each student. Sort your results by the total number of challenges in descending order. If more than one student created the same numbe..
코테준비 | Second Highest Salary (의도적으로 null 값 출력하기)
·
SQL
☑️  176. Second Highest Salary[문제]Write a solution to find the second highest distinct salary from the Employee table. If there is no second highest salary, return null (return None in Pandas).두번째로 높은 연봉자 조회하기, 없다면 null 로 반환[문제 풀이]내 코드 - window & with 문WITH dnkt AS (SELECT * ,DENSE_RANK() OVER (ORDER BY salary DESC) as dnk ,count(id) OVER () AS total_cntsFROM employee), nullt AS (SELEC..
QCC | 4회차 코드 리뷰 & 피드백
·
SQL
☑️  문제 1. 지역별 매출이 가장 높은 매장의 지역 조회[문제]지역별로 매출이 가장 높은 매장의 매출을 조회하는 SQL 문을 작성해주세요단, 해당 지역에 매장이 두 개 이상인 경우만 결과에 포함해주세요. 결과는 지역 이름을 기준으로 오름차순으로 정렬해주세요.[문제 풀이]내 코드 SELECT REGION_NAME AS region_name ,MAX(SALES) AS highest_salesFROM stores WHERE REGION_NAME IN (SELECT REGION_NAME FROM stores s GROUP BY REGION_NAME HAVING COUNT(DISTINCT STORE_ID) >=2)GROUP BY REGION_NAMEORDER BY REGION_NA..
코테 준비 | Group Sold Products By The Date(group_concat)
·
SQL
☑️  1484. Group Sold Products By The Date[문제]Write a solution to find for each date the number of different products sold and their names.Return the result table ordered by sell_date.The sold products names for each date should be sorted lexicographically.날짜별 팔린 제품 갯수 집계 및 팔린 제품명 한 컬럼에 기재 [문제 풀이]내 코드 → 끝까지 못 품 (실패)WITH rownt AS (SELECT sell_date ,product ,ROW_NUMBER() OVER (PARTITION ..
코테준비 | Patients With a Condition (문자열 추출 - 정규표현식 REGEXP , 특정문자기준 슬라이싱 - SUBSTRING_INDEX)
·
SQL
☑️  Patients With a Condition[문제]Write a solution to find the patient_id, patient_name, and conditions of the patients who have Type I Diabetes. Type I Diabetes always starts with DIAB1 prefix.'DIAB1' 가 접두사인 값 모두 출력 [문제 풀이]코드1 - LIKESELECT *FROM PATIENTS WHERE conditions LIKE 'DIAB1%' OR conditions LIKE '% DIAB1% 코드2 - REGEXP SELECT *FROM PATIENTS WHERE conditions REGEXP '^DIAB1' OR conditi..