- 博客(17)
- 收藏
- 关注
原创 Leetcode - 3个及3个以上的问题 - 601. Human Traffic of Stadium
问题:X city built a new stadium, each day many people visit it and the stats are saved as these columns:id,visit_date,peoplePlease write a query to display the records which have 3 or more consec...
2019-11-14 07:54:29 215 1
原创 Visualization in Python
1. Matplotlibimport matplotlib.pyplot as plt%matplotlib inlineimport warningswarnings.filterwarnings('ignore')a. line chartimport numpy as npplt.plot(x,y)plt.xlabel('X Label')plt.ylabel...
2020-02-24 12:36:17 675
原创 Leetcode - 查找中位数 - 569. Median Employee Salary
问题如下:TheEmployeetable holds all employees. The employee table has three columns: Employee Id, Company Name, and Salary.+-----+------------+--------+|Id | Company | Salary |+-----+-------...
2019-11-15 07:37:55 800
原创 Leetcode - 579. Find Cumulative Salary of an Employee
TheEmployeetable holds the salary information in a year.Write a SQL to get the cumulative sum of an employee's salary over a period of 3 months but exclude the most recent month.The result shoul...
2019-10-04 02:10:47 462
原创 Leetcode - 626. Exchange Seats
Mary is a teacher in a middle school and she has a tableseatstoring students' names and their corresponding seat ids.The columnidis continuous increment.Mary wants to change seats for the adja...
2019-10-04 01:59:57 266
原创 Leetcode - create function in mysql - 177. Nth Highest Salary
以leetcode上这道题为例:Write a SQL query to get thenthhighest salary from theEmployeetable.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+-----...
2019-10-03 11:04:56 259
原创 Leetcode - Mysql ranking questions - 178. Rank Scores
以leetcode上这道题为例:Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecuti...
2019-10-02 13:09:19 195
原创 hackerrank - MySql rank如何实现
MySQL:使用user-defined variable来给table进行普通排序比如Player table如下:pid name age 1 Samual 25 2 Vino 20 3 John 20 4 Andy 22 5 Brian 21 6 Dew 24...
2019-10-02 07:44:35 364
原创 Leetcode - 1204. Last Person to Fit in the Elevator
Table:Queue+-------------+---------+| Column Name | Type |+-------------+---------+| person_id | int || person_name | varchar || weight | int || turn | int |+--...
2019-10-02 06:31:01 2164
原创 hackerrank - Advanced Join - SQL Project Planning
You are given a table,Projects, containing three columns:Task_ID,Start_DateandEnd_Date. It is guaranteed that the difference between theEnd_Dateand theStart_Dateis equal to1day for each row...
2019-09-29 05:03:59 1129
原创 hackerrank - Aggregation - Weather Observation Station 20
这道题是找中位数Amedianis defined as a number separating the higher half of a data set from the lower half. Query themedianof theNorthern Latitudes(LAT_N) fromSTATIONand round your answer todecima...
2019-09-28 06:11:34 1144 1
原创 hackerrank - Basic Join - Top Competitors
这题有多个table,尽量避免全部join在一起,可以两两join,找相同Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respectivehacker_idandnameof ...
2019-09-27 10:57:56 675
原创 hackerrank - Basic Join - Contest Leaderboard
这题主要用了sub-queryYou did such a great job helping Julia with her last coding contest challenge that she wants you to work on this one, too!The total score of a hacker is the sum of their maximum sco...
2019-09-27 09:39:45 256 1
原创 hackerrank - Basic Join - Challenges
这道题考察了having以及sub-queryJulia asked her students to create some coding challenges. Write a query to print thehacker_id,name, and the total number of challenges created by each student. Sort your re...
2019-09-27 08:59:06 1427
原创 hackerrank - Basic Join - Ollivander's Inventory
Harry Potter and his friends are at Ollivander's with Ron, finally replacing Charlie's old broken wand.Hermione decides the best way to choose is by determining the minimum number of gold galleons n...
2019-09-27 07:53:36 488
原创 hackerrank SQL-Advanced Select - Occupations (User-Defined Variable)
PivottheOccupationcolumn inOCCUPATIONSso that eachNameis sorted alphabetically and displayed underneath its correspondingOccupation. The output column headers should beDoctor,Professor,Sing...
2019-09-27 02:26:01 1206
原创 hackerrank SQL-Advanced Select - The PADS
Generate the following two result sets:Query analphabetically orderedlist of all names inOCCUPATIONS, immediately followed by the first letter of each profession as a parenthetical (i.e.: enclose...
2019-09-26 07:37:16 416
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人