SQL | LeetCode 570. 직속 부하 직원이 5명 이상인 매니저 찾기
·
Computer Science/SQL
매니저는 다른 직원들의 managerId로 등장합니다. 즉, managerId를 기준으로 그룹화해서 해당 값을 가진 사람이 몇 명의 직원을 관리하는지 세면 됩니다.Table: Employee+-------------+---------+| Column Name | Type |+-------------+---------+| id | int || name | varchar || department | varchar || managerId | int |+-------------+---------+id is the primary key (column with unique values) for this table.Each row of this table indi..
SQL | LeetCode 1280. Nested Join
·
Computer Science/SQL
학교에는 여러 명의 학생들과 여러 과목이 있고, 각 학생은 모든 과목의 시험을 치릅니다. 우리는 각 학생이 각 과목의 시험을 몇 번 봤는지 알고 싶습니다. Table: Students+---------------+---------+| Column Name | Type |+---------------+---------+| student_id | int || student_name | varchar |+---------------+---------+student_id is the primary key (column with unique values) for this table.Each row of this table contains the ID and the name of one st..
SQL | LeetCode 1661. Self Join + GROUP BY
·
Computer Science/SQL
공장 내 여러 머신이 여러 개의 프로세스를 처리하며, 각 프로세스는 시작(start)과 종료(end) 시각을 갖고 있습니다. 각 머신별 평균 처리 시간(end - start)을 계산해야 합니다.Table: Activity+----------------+---------+| Column Name | Type |+----------------+---------+| machine_id | int || process_id | int || activity_type | enum || timestamp | float |+----------------+---------+The table shows the user activities for a factory w..
SQL | LeetCode 197. 셀프 조인(Self Join)과 DATE_ADD를 활용한 날짜 비교 문제
·
Computer Science/SQL
기온 데이터가 저장된 Weather 테이블이 주어졌을 때, 전날보다 더 따뜻했던 날짜의 id를 구하는 문제입니다.Table: Weather+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || recordDate | date || temperature | int |+---------------+---------+id is the column with unique values for this table.There are no different rows with the same recordDate.This table contains informat..
SQL | LeetCode 1581. 방문은 했지만 거래는 없던 고객 찾기 (RIGHT JOIN & GROUP BY 예제)
·
Computer Science/SQL
이 포스팅에서는 RIGHT JOIN을 활용해 거래가 일어나지 않은 고객 방문을 찾아보겠습니다. 일반적으로 LEFT JOIN이 더 익숙하겠지만, RIGHT JOIN으로도 같은 문제를 해결할 수 있습니다.Table: Visits+-------------+---------+| Column Name | Type |+-------------+---------+| visit_id | int || customer_id | int |+-------------+---------+visit_id is the column with unique values for this table.This table contains information about the customers who visited th..
SQL | LeetCode 1683. 문자열 길이 함수
·
Computer Science/SQL
Table: Tweets+----------------+---------+| Column Name | Type |+----------------+---------+| tweet_id | int || content | varchar |+----------------+---------+tweet_id is the primary key (column with unique values) for this table.content consists of alphanumeric characters, '!', or ' ' and no other special characters.This table contains all the tweets in a social media app...
올리브한입
'Computer Science/SQL' 카테고리의 글 목록 (7 Page)