Back to questions

SQL Math Practice Exercise: Big-Mover Months SQL Interview Question

SQL Math Practice Exercise: Big-Mover Months

SQL Interview Question

Display the stocks which had "big-mover months", and how many of those months they had. Order your results from the stocks with the most, to least, "big-mover months".

What is a big-mover month?

A "big-mover month" is when a stock closes up or down by greater than 10% compared to the price it opened at.

For example, when COVID hit and e-commerce became the new normal, Amazon stock in April 2020 had a big-mover month because the price shot up from $96.65 per share at open to $123.70 at close – a 28% increase!

tickerdateopenclosepercent_change
AMZN04/01/2020 00:00:0096.65123.7028.0
NFLX04/01/2022 00:00:00376.80190.36-49.5

Netflix stock had a big-mover month in April 2022 in the reverse direction. That month, Netflix reported that the company lost 200k subscribers in Q1, and expected to lose another two million subs in Q2. In Apr'22, Netflix stock opened that month at $376.80 per share, but closed at $190.36, representing a 49.5% loss – yikes!

Example Input:

datetickeropenhighlowclose
01/31/2020 00:00:00GOOG67.0875.1667.0871.71
01/31/2020 00:00:00META206.75224.20201.06201.91
01/31/2020 00:00:00MSFT158.78174.05156.51170.23
01/31/2020 00:00:00AMZN93.75102.7990.77100.44
01/31/2020 00:00:00NFLX326.10359.85321.20345.09

Example Output:

tickercount
META20
AMZN13
GOOG12
NFLX10
AAPL8
MSFT6

Difficulty

Easy

Input

Output