logo

Back to questions

Easy SQL GROUP BY Practice Exercise [SQL Interview Question]

Easy

For every FAANG stock in the stock_prices dataset, write a SQL query to find the lowest price each stock ever opened at? Be sure to also order your results by price, in descending order.

Sample stock_prices Input:

datetickeropenhighlowclose
01/01/2020 00:00:00GOOG67.0875.1667.0871.71
01/01/2020 00:00:00NFLX326.10359.85321.20345.09
01/01/2020 00:00:00AAPL74.0681.9673.1977.38
01/01/2020 00:00:00AMZN93.75102.7990.77100.44
01/01/2020 00:00:00MSFT158.78174.05156.51170.23

Example Output:

tickermin
NFLX176.49
AMZN85.46
AAPL61.63
GOOG56.10
META94.33
MSFT153.00

PostgreSQL 14