Back to questions

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


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.


Column NameTypeDescription
datedatetimeThe specified date (mm/dd/yyyy) of the stock data.
tickervarcharThe stock ticker symbol (e.g., AAPL) for the corresponding company.
opendecimalThe opening price of the stock at the start of the trading day.
highdecimalThe highest price reached by the stock during the trading day.
lowdecimalThe lowest price reached by the stock during the trading day.
closedecimalThe closing price of the stock at the end of the trading day.

Example Input:

01/31/2023 00:00:00GOOG89.83101.5885.5799.87
02/28/2023 00:00:00GOOG99.74108.8288.8690.30
03/31/2023 00:00:00GOOG90.16107.5189.77104.00
04/30/2023 00:00:00GOOG102.67109.63102.38108.22
05/31/2023 00:00:00GOOG107.72127.05104.50123.37

PostgreSQL 14