logo

Back to questions

SQL Tutorial Lesson: Stock Performance [Bloomberg SQL Interview Question]

Hard

The Bloomberg terminal is the go-to resource for financial professionals, offering convenient access to a wide array of financial datasets. In this SQL interview query for Data Analyst at Bloomberg, you're given the historical data on Google's stock performance.

Your task is to:

  1. Calculate the difference in closing prices between consecutive months.
  2. Calculate the difference between the closing price of the current month and the closing price from 3 months prior.

This question serves as a platform for you to explore into the dataset and execute your queries. Please refrain from submitting your solution for this question.

Schema:

Column NameTypeDescription
datedatetimeThe specific date and time of the stock data.
tickervarcharIndicates the stock ticker symbol (e.g., GOOG) for the corresponding company.
opendecimal (5,2)The opening price of the stock on that particular date.
highdecimal (5,2)The highest price reached by the stock during the day.
lowdecimal (5,2)The lowest price reached by the stock during the day.
closedecimal (5,2)The closing price of the stock at the end of the trading day.

Example Input:

datetickeropenhighlowclose
08/01/2023 00:00:00GOOG130.85132.92127.78130.17
07/01/2023 00:00:00GOOG120.32134.07115.83133.11
06/01/2023 00:00:00GOOG123.50129.55116.91120.97
05/01/2023 00:00:00GOOG107.72127.05104.50123.37
04/01/2023 00:00:00GOOG102.67109.63102.38108.22

PostgreSQL 14