일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- forecast
- 웨어하우스 보관 최적화
- 코딩테스트
- Inventory Optimization
- 파이썬
- TensorFlowGPU
- eda
- Labor Management System
- Gaimification
- SKU Consolidation
- ProfileReport
- 프로그래머스
- ModelCheckPoint
- HackerRank
- leetcode
- MS SQL Server
- SQL
- kaggle
- 피그마인디언
- ABC Analysis
- 코딩테스트연습
- MySQL
- tensorflow
- Product Demand
- 딥러닝
- 신경쓰기의 기술
- oracle
- pandas profiling
- 데이터분석
- Today
- Total
목록SQL (81)
오늘도 배운다

문제 source: 프로그래머스 CAR_RENTAL_COMPANY_RENTAL_HISTORY 테이블에서 2022년 10월 16일에 대여 중인 자동차인 경우 '대여중' 이라고 표시하고, 대여 중이지 않은 자동차인 경우 '대여 가능'을 표시하는 컬럼(컬럼명: AVAILABILITY)을 추가하여 자동차 ID와 AVAILABILITY 리스트를 출력하는 SQL문을 작성해주세요. 이때 반납 날짜가 2022년 10월 16일인 경우에도 '대여중'으로 표시해주시고 결과는 자동차 ID를 기준으로 내림차순 정렬해주세요. 제출답안(MySQL) SELECT car_id, CASE WHEN start_date = '2022-10-16' THEN '대여중' ELSE '대여 가능' END AS availability FROM (SE..

문제 source: LeetCode CAR_RENTAL_COMPANY_CAR 테이블과 CAR_RENTAL_COMPANY_RENTAL_HISTORY 테이블에서 자동차 종류가 '세단'인 자동차들 중 10월에 대여를 시작한 기록이 있는 자동차 ID 리스트를 출력하는 SQL문을 작성해주세요. 자동차 ID 리스트는 중복이 없어야 하며, 자동차 ID를 기준으로 내림차순 정렬해주세요. 제출답안(MySQL) SELECT DISTINCT (c.car_id) FROM car_rental_company_car AS c LEFT JOIN car_rental_company_rental_history AS h ON c.car_id = h.car_id WHERE MONTH(start_date) = 10 AND car_type = ..

문제 source: 프로그래머스 USED_GOODS_BOARD와 USED_GOODS_USER 테이블에서 중고 거래 게시물을 3건 이상 등록한 사용자의 사용자 ID, 닉네임, 전체주소, 전화번호를 조회하는 SQL문을 작성해주세요. 이때, 전체 주소는 시, 도로명 주소, 상세 주소가 함께 출력되도록 해주시고, 전화번호의 경우 xxx-xxxx-xxxx 같은 형태로 하이픈 문자열(-)을 삽입하여 출력해주세요. 결과는 회원 ID를 기준으로 내림차순 정렬해주세요. 제출답안(MySQL) SELECT user_id, nickname, CONCAT(city,' ', street_address1, CASE WHEN street_address2 = '' THEN '' ELSE CONCAT(' ', street_address..

문제 source: 프로그래머스 USED_GOODS_BOARD와 USED_GOODS_FILE 테이블에서 조회수가 가장 높은 중고거래 게시물에 대한 첨부파일 경로를 조회하는 SQL문을 작성해주세요. 첨부파일 경로는 FILE ID를 기준으로 내림차순 정렬해주세요. 기본적인 파일경로는 /home/grep/src/ 이며, 게시글 ID를 기준으로 디렉토리가 구분되고, 파일이름은 파일 ID, 파일 이름, 파일 확장자로 구성되도록 출력해주세요. 조회수가 가장 높은 게시물은 하나만 존재합니다. 제출답안(MySQL) SELECT CONCAT('/home/grep/src/',board_id, '/', file_id, file_name, file_ext) AS FILE_PATH FROM used_goods_file WHER..

문제 source: LeetCode A company's executives are interested in seeing who earns the most money in each of the company's departments. A high earner in a department is an employee who has a salary in the top three unique salaries for that department. Write an SQL query to find the employees who are high earners in each of the departments. Return the result table in any order. 제출답안(MySQL) WITH emp_sa..

문제 source: LeetCode Write an SQL query to display the records with three or more rows with consecutive id's, and the number of people is greater than or equal to 100 for each. Return the result table ordered by visit_date in ascending order. 제출답안(MySQL) WITH std AS ( SELECT id, visit_date, people, id - ROW_NUMBER() OVER(ORDER BY id) AS row_num FROM stadium WHERE people >= 100 ), std_cons AS ( SE..

문제 source: LeetCode The cancellation rate is computed by dividing the number of canceled (by client or driver) requests with unbanned users by the total number of requests with unbanned users on that day. Write a SQL query to find the cancellation rate of requests with unbanned users (both client and driver must not be banned) each day between "2013-10-01" and "2013-10-03". Round Cancellation Ra..

문제 source: LeetCode Write an SQL query to report the names of all the salespersons who did not have any orders related to the company with the name "RED". Return the result table in any order. 제출답안(MySQL) WITH red_sp AS ( SELECT sales_id FROM orders WHERE com_id = (SELECT com_id FROM company WHERE name ='RED') ) SELECT name FROM salesperson WHERE sales_id NOT IN (SELECT sales_id FROM red_sp) 문제 ..