[leetcode][Database][Hard] 185. Department Top Three Salaries

題目 Table: Employee +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +--------------+---------+ id is the primary key column for this table. departmentId is a foreign key of the ID from the Department table. Each row of this table indicates the ID, name, and salary of an employee. It also...

<span title='2022-12-06 17:21:44.783 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;677 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 262. Trips and Users

題目 Table: Trips +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | client_id | int | | driver_id | int | | city_id | int | | status | enum | | request_at | date | +-------------+----------+ id is the primary key for this table. The table holds all taxi trips. Each trip has a unique id, while client_id and driver_id are foreign keys...

<span title='2022-12-06 17:08:27.973 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;836 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 569. Median Employee Salary

題目 Table: Employee +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | company | varchar | | salary | int | +--------------+---------+ id is the primary key column for this table. Each row of this table indicates the company and the salary of one employee. Write an SQL query to find the rows that contain the median salary of each company. While calculating the...

<span title='2022-12-06 16:48:49.861 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;502 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 571. Find Median Given Frequency of Numbers

題目 Table: Numbers +-------------+------+ | Column Name | Type | +-------------+------+ | num | int | | frequency | int | +-------------+------+ num is the primary key for this table. Each row of this table shows the frequency of a number in the database. The median is the value separating the higher half from the lower half of a data sample. Write an SQL query to report the median...

<span title='2022-12-06 16:31:02.761 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;646 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 579. Find Cumulative Salary of an Employee

題目 Table: Employee +-------------+------+ | Column Name | Type | +-------------+------+ | id | int | | month | int | | salary | int | +-------------+------+ (id, month) is the primary key for this table. Each row in the table indicates the salary of an employee in one month during the year 2020. Write an SQL query to calculate the cumulative salary summary for every employee in a...

<span title='2022-12-06 15:18:29.163 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;786 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 601. Human Traffic of Stadium

題目 Table: Stadium +---------------+---------+ | Column Name | Type | +---------------+---------+ | id | int | | visit_date | date | | people | int | +---------------+---------+ visit_date is the primary key for this table. Each row of this table contains the visit date and visit id to the stadium with the number of people during the visit. No two rows will have the same visit_date, and as the...

<span title='2022-12-06 14:55:01.53 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;741 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 615. Average Salary: Departments VS Company

題目 Table: Salary +-------------+------+ | Column Name | Type | +-------------+------+ | id | int | | employee_id | int | | amount | int | | pay_date | date | +-------------+------+ id is the primary key column for this table. Each row of this table indicates the salary of an employee in one month. employee_id is a foreign key from the Employee table. Table: Employee +---------------+------+ | Column...

<span title='2022-12-06 14:33:17.216 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;671 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 618. Students Report By Geography

題目 Table: Student +-------------+---------+ | Column Name | Type | +-------------+---------+ | name | varchar | | continent | varchar | +-------------+---------+ There is no primary key for this table. It may contain duplicate rows. Each row of this table indicates the name of a student and the continent they came from. A school has students from Asia, Europe, and America. Write an SQL query to pivot the continent...

<span title='2022-12-06 14:08:14.796 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;1 分鐘&nbsp;·&nbsp;449 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 1097. Game Play Analysis V

題目 Table: Activity +--------------+---------+ | Column Name | Type | +--------------+---------+ | player_id | int | | device_id | int | | event_date | date | | games_played | int | +--------------+---------+ (player_id, event_date) is the primary key of this table. This table shows the activity of players of some games. Each row is a record of a player who logged in and played a number of games (possibly...

<span title='2022-12-06 13:48:34.28 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;570 字&nbsp;·&nbsp;ZhengWei, Liu

[leetcode][Database][Hard] 1127. User Purchase Platform

題目 Table: Spending +-------------+---------+ | Column Name | Type | +-------------+---------+ | user_id | int | | spend_date | date | | platform | enum | | amount | int | +-------------+---------+ The table logs the history of the spending of users that make purchases from an online shopping website that has a desktop and a mobile application. (user_id, spend_date, platform) is the primary key of this table. The...

<span title='2022-12-06 13:21:25.529 +0000 UTC'>December 6, 2022</span>&nbsp;·&nbsp;2 分鐘&nbsp;·&nbsp;867 字&nbsp;·&nbsp;ZhengWei, Liu