11 Nasdaq SQL Interview Questions (Updated 2024)

Updated on

June 30, 2024

Nasdaq employees use SQL often for analyzing stock market data patterns and managing databases for financial reporting. Because of this, Nasdaq covers SQL questions in interviews for Data Science and Data Engineering positions.

Thus, to help you prepare, we've collected 11 Nasdaq SQL interview questions – able to answer them all?

Nasdaq SQL Interview Questions

11 Nasdaq SQL Interview Questions

SQL Question 1: Analyze Trading Volume Trends for a Specific Stock

Let's imagine, that as a data analyst at Nasdaq, you have been asked to analyze trading volume trends for a specific stock. Create a SQL query that can be used to calculate the average daily trading volume for a specific stock over the last three months, compared with the same period the previous year.

Here's a hypothetical table of daily trading volumes per stock:

Example Input:

We want to know, for example, the average daily volume for the stock symbol AAPL over the last three months (June 01, 2022 - August 31, 2022), compared with the same period (June 01, 2021 - August 31, 2021) the previous year.


This query uses window function to calculate the average daily trading volume for the given period, and then compares it with the average daily trading volume for the same period from the previous year for the specified stock.

For more window function practice, try this Uber SQL Interview Question on DataLemur's interactive SQL code editor:

Uber Window Function SQL Interview Question

SQL Question 2: Top Three Salaries

Given a table of Nasdaq employee salaries, write a SQL query to find the top 3 highest earning employees within each department.

Nasdaq Example Input:

1Emma Thompson38001
2Daniel Rodriguez22301
3Olivia Smith20001
4Noah Johnson68002
5Sophia Martinez17501
8William Davis68002
10James Anderson40001

Example Input:

1Data Analytics
2Data Science

Example Output:

Data AnalyticsJames Anderson4000
Data AnalyticsEmma Thompson3800
Data AnalyticsDaniel Rodriguez2230
Data ScienceNoah Johnson6800
Data ScienceWilliam Davis6800

Solve this problem interactively on DataLemur:

Top 3 Department Salaries


We use the DENSE_RANK() window function to generate unique ranks for each employee's salary within their department, with higher salaries receiving lower ranks. Then, we wrap this up in a CTE and filter the employees with a ranking of 3 or lower.

If the solution above is tough, you can find a detailed solution with hints here: Top 3 Department Salaries.

Stay up to date and read up on recent news and insights from Nasdaq!

SQL Question 3: What are database views used for?

Views are a lot like virtual tables, where you can take a base table and customize it (such as by hiding some data from non-admin users, or removing some random columns/rows based on business requirements).

Here's the PostgreSQL syntax for creating a view based on data in the table:

Nasdaq SQL Interview Questions

SQL Question 4: Filter Traders based on Trading Activity and Stock Sector

You work as a part of the analytics team at Nasdaq. You are given access to the two databases - 'traders' and 'trades'. The 'traders' database contains the detail of each trader along with their registration date and the 'trades' database contains the record for each deal made by traders. Your task is to write a SQL query that filters out traders who registered after '01/01/2020' and made more than 10 trades in the 'Technology' sector.

Example Input:
Sample Input:


This query first identifies all trades that were made in the 'Technology' sector and counts the number of trades for each trader. This is done in the subquery . This subquery is then joined to the table using a JOIN clause. Finally, this query filters down the result to only contain traders who registered after '01/01/2020' and made more than 10 trades in the 'Technology' sector.

SQL Question 5: Can you explain what / SQL commands do?

The / operator is used to remove to return all rows from the first SELECT statement that are not returned by the second SELECT statement.

Note that is available in PostgreSQL and SQL Server, while MINUS is available in MySQL and Oracle (but don't stress about knowing which DBMS supports what exact commands since the interviewers at Nasdaq should be lenient!).

Here's a PostgreSQL example of using EXCEPT to find all of Nasdaq's Facebook video ads with more than 10k views that aren't also being run on YouTube:

If you want to retain duplicates, you can use the EXCEPT ALL operator instead of EXCEPT. The EXCEPT ALL operator will return all rows, including duplicates.

SQL Question 6: Average Daily Trading Volume for Stocks

As a Financial Analyst at Nasdaq, you are interested in understanding the average daily trading volume for different stocks. Trading volume represents the total number of stocks traded for a specified company. Write a SQL query to find the average daily trading volumes for each stock listed in Nasdaq for the month of May 2022.

Example Input:
Example Output:


The above SQL statement groups the trading volume data for each stock(ticker) and calculates their average for the month of May 2022. The WHERE clause is used to filter the data for the month of May 2022. The AVG function is used to calculate the average trading volume for each stock.

The two most similar questions could be:

  1. "Cities With Completed Trades" at Robinhood. Reason: It involves trading-related data and aggregation.
  2. "Highest-Grossing Items" at Amazon. Reason: It involves average calculations on financial data.

However, the final markdown would be generated as follows:

To practice a very similar question try this interactive Robinhood Cities With Completed Trades Question which is similar for involving trading-related data and aggregation or this Amazon Highest-Grossing Items Question which is similar for involving average calculations on financial data.

SQL Question 7: What's a self-join, and when would you use one?

A self-join is a type of JOIN where a table is joined to itself. To execute a self-join, you must include the table name twice in the FROM clause and assign a different alias to each instance. You can then join the two copies of the table using a JOIN clause, and use a WHERE clause to specify the relationship between the rows.

For instance, suppose you had website visitor data for Nasdaq, exported from the company's Google Analytics account. To assist the web-dev team, you needed to analyze pairs of pages for UX or navigational issues. As part of that analysis, you wanted to generate all pairs of URLs, but needed to exclude pairs where both URLs were the same since that is not a valid pair."

You could use the following self-join:

This query returns the url of each page () along with the url of the page that referred to it (). The self-join is performed using the field, which specifies the id of the page that referred the visitor to the current page, and avoids any pages that referred themself (aka data anomalies).

SQL Question 8: Calculate Average Trade Volume

Imagine you're working for Nasdaq and are tasked with tracking the average daily trading volume for each stock on a monthly basis.

Example Input:


Example Output:



This query first extracts the month from the trade date, then groups by both the extracted month and the stock symbol. It calculates the average daily trade volume for each stock by month. The output is ordered by month and stock symbol.

SQL Question 9: Fetch Companies Listed in NASDAQ having "TECH" in Their Names

You have a database that contains a list of companies listed in Nasdaq exchange. The table consists of the columns , , , and . Write an SQL query that retrieves all companies which have "TECH" in their names.

Example Input:
1'APPLE INC''12/12/1980''TECHNOLOGY''Tim Cook'
3'MICROSOFT CORP''03/13/1986''TECHNOLOGY''Satya Nadella'
5'FACEBOOK INC''05/18/2012''COMMUNICATION SERVICES''Mark Zuckerberg'
7'TECH DATA CORP''11/02/1984''TECHNOLOGY''Rich Hume'


This query uses the keyword in SQL which allows us to match text string patterns. In this case, we are retrieving all records from table where the company's name contains the string 'TECH'. The '%' sign is a wild card that matches any number of characters.

SQL Question 10: Why would you use the SQL constraint?

The CHECK constraint is used to enforce rules on the data in a specific column. If a row is inserted or updated with data that does not follow the CHECK constraint's rule, the operation will fail.

For example, say you had a marketing analytics database that stores ad campaign data from Nasdaq's Google Analytics account.

Here's what some constraints could look like:

The CHECK constraint is used in the above example to make sure that the "budget" and "cost_per_click" fields contain only positive values. This helps to maintain the validity and integrity of the data in the context of ad campaigns.

The CHECK constraint can also be used to enforce other specific conditions on data. For example, you can use it to ensure that the "start_date" for each ad campaign is earlier than the "end_date."

SQL Question 11: Stock Trade Analysis

For the company Nasdaq, you have been given two tables - 'customers' and 'trades'.

The 'customers' table has a unique id for each customer, along with additional information such as the customer's name and country.

The 'trades' table has a record of all trades done by customers, including the id of the customer who did the trade, the stock symbol, the trade amount and the trade date.

Write a SQL query to find out the total trade amount for each stock symbol for customers from the United States in the year 2021.

Sample Input:
1John DoeUnited States
2Jane SmithUnited Kingdom
3Alice JohnsonUnited States
Sample Input:


This query first joins the 'trades' table with the 'customers' table on the . It then applies a filter to restrict the records to only those where the customer's country is 'United States' and the trade date is in the year 2021. It finally performs a group by operation on the and calculates the total trade amount for each stock symbol.

Since join questions come up frequently during SQL interviews, try this SQL join question from Spotify: SQL join question from Spotify

Preparing For The Nasdaq SQL Interview

The best way to prepare for a SQL interview, besides making sure you have strong SQL fundamentals, is to practice a ton of real SQL questions that were asked in recent job interviews. Besides solving the above Nasdaq SQL interview questions, you should also solve the 200+ FAANG SQL Questions on DataLemur which come from companies like Google, Facebook, Microsoft and Amazon. DataLemur SQL and Data Science Interview Questions

Each DataLemur SQL question has hints to guide you, fully explained answers along with a discussion board to see how others solved it and best of all, there is an interactive coding environment so you can instantly run your SQL query answer and have it graded.

To prep for the Nasdaq SQL interview it is also helpful to practice SQL questions from other stock exchange & brokerage companies like:

In case your SQL coding skills are weak, don't worry about diving straight into solving questions – improve your SQL foundations with this SQL tutorial for Data Analytics.

SQL interview tutorial

This tutorial covers SQL concepts such as filtering data with WHERE and turning a subquery into a CTE – both of which show up often during SQL job interviews at Nasdaq.

Nasdaq Data Science Interview Tips

What Do Nasdaq Data Science Interviews Cover?

In addition to SQL interview questions, the other topics covered in the Nasdaq Data Science Interview are:

  • Statistics and Probability Questions
  • Python Pandas or R Coding Questions
  • Open-Ended Data Case Studies
  • ML Modelling Questions
  • Behavioral & Resume-Based Questions

Nasdaq Data Scientist

How To Prepare for Nasdaq Data Science Interviews?

To prepare for Nasdaq Data Science interviews read the book Ace the Data Science Interview because it's got:

  • 201 interview questions sourced from Google, Microsoft & tech startups
  • a crash course on Stats, ML, & Data Case Studies
  • over 1000+ reviews on Amazon & 4.5-star rating

Ace the DS Interview