10 Zeta Global SQL Interview Questions (Updated 2024)

Updated on

March 3, 2024

At Zeta Global, SQL is often used for analyzing customer behavior trends and creating advertising customer segments which marketers can then target. That's why Zeta Global almost always evaluates jobseekers on SQL coding questions in interviews for Data Analytics, Data Science, and Data Engineering jobs.

Thus, to help you prepare for the Zeta Global SQL interview, we've curated 10 Zeta Global SQL interview questions – able to answer them all?

10 Zeta Global SQL Interview Questions

SQL Question 1: Identifying Whale Users

Zeta Global, being a data-driven marketing technology company, cares deeply about the behavior of its active users, particularly the highly engaged ones. One of the crucial tasks for the company is to identify "whale users". These users are ones who have an exceptionally high website visit frequency, as they utilize the services provided frequently and have proven to be a significant source of revenue for the business.

You are given a database of user web activity with two tables: and .

Example Input:
Example Input:

Write a SQL query to identify the "whale users" – the users who have visited the website more than 5 times in the last 7 days. Return a list of user_ids and number of visits.


This query identifies the "whale users" by filtering for the users who visited the website more than 5 times in the last 7 days. The result includes the user_id and the number of website visits. The list is sorted in descending order of the number of visits.

To practice a related customer analytics question on DataLemur's free online SQL coding environment, try this Microsoft Azure Cloud SQL Interview Question: Microsoft SQL Interview Question: Super Cloud Customer

SQL Question 2: Finding the Quarterly Marketing Spend per Client

At Zeta Global, imagine you are a data analyst who is asked to help the marketing team understand the company's marketing expenditure per client per quarter. The database contains a table named with columns , , . You have to write an SQL query to calculate the total marketing spend for each client per quarter. The quarter should be derived from the .

Example Input:

The output should include , and , sorted by and .

Example Output:


In PostgreSQL, you can extract the quarter from a date with and perform a group by on this expression along with client_id. Here is how you can solve this problem:

This query first groups the rows by and and then sums the for each group. The resulting total spend for each client in each quarter is displayed and sorted by and .

Pro Tip: Window functions are a popular SQL interview topic, so practice all the window function problems on DataLemur

DataLemur SQL Questions

SQL Question 3: What's a database view?

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:

Zeta Global SQL Interview Questions

SQL Question 4: Filter Customers Based on Interaction and Location

As a data analyst at Zeta Global, your duty includes generating insights from the customer database. You are tasked with creating a list of active customers, who are located in New York and have had any form of interaction (like product purchase, query, or complaint) within the last 3 months for a marketing campaign.

For the purpose of this task, active customers are ones who made a purchase within the last year. Use the , , and tables.

Example Input:


Example Input:

201101New YorkNY
202102Los AngelesCA
203103New YorkNY
205105New YorkNY

Example Input:



This SQL query first establishes links between customers, their locations, and their interactions. Then it filters customers based on the criteria: customers that made a purchase within the last year, had an interaction within the last 3 months, and are located in New York.

SQL Question 5: In database design, what do foreign keys do?

A foreign key is a field in a database table that links to the primary key of another table, establishing a connection between the two tables. For example, let's analyze Zeta Global's Google Ads campaigns data:


+------------+------------+------------+------------+ | ad_id | campaign_id| keyword | click_count| +------------+------------+------------+------------+ | 1 | 201 | Zeta Global reviews | 120 | | 2 | 202 | Zeta Global pricing | 150 | | 3 | 101 | buy Zeta Global | 65 | | 4 | 101 | Zeta Global alternatives | 135 | +------------+------------+------------+------------+

is a foreign key that connects to the of the corresponding Google Ads campaign. This establishes a relationship between the ads and their campaigns, enabling easy querying to find which ads belong to a specific campaign or which campaigns a specific ad belongs to.

The table may also have multiple foreign keys that reference primary keys in other tables. For example, and foreign keys could be used to link each ad to its ad group and the Google Ads account that the campaigns belong to, respectively.

SQL Question 6: Calculate Click Through Conversion Rates for Zeta Global

Zeta Global, a digital marketing company, wants to assess the performance of its various digital advertisement campaigns. They are interested in understanding the click-through conversion rates of their advertisements. Conversion, in this case, is defined by the action of a user viewing an advertised product and then adding that product to their cart.

You are provided with two tables and . The table records every instance a user clicks on an advertisement to view a product. The table logs every instance a user adds a product into their cart after viewing it.

Example Input:
10115672015000106/18/2022 09:00:00
10128902026985206/19/2022 10:30:00
10134562015000106/20/2022 21:00:00
10148902025000106/21/2022 08:25:00
10151232036985206/23/2022 12:00:00
Example Input:
50115675000106/18/2022 09:05:00
50128906985206/19/2022 10:31:00
50134565000106/20/2022 21:05:00
50147605000106/22/2022 15:45:00
50151236985206/24/2022 10:20:00

Write a SQL query that calculates the click-through conversion rate for each product. This is calculated as the number of times a clicked product was added to the cart, divided by the total number of clicks the product received.


This SQL query starts by joining the table with the table on and where the click time is is lesser or equal to the cart addition time. This effectively pairs each click of a product with the subsequent addition of the same product to the user's cart.

Then, for each product, it calculates the click through conversion rate as the number of instances a product was added to the cart (found in the table) divided by the total number of clicks each product received (found in the table).

To solve a similar problem about calculating rates, try this SQL interview question from TikTok within DataLemur's interactive SQL code editor: SQL interview question from TikTok

SQL Question 7: Consider unique indexes, and non-unique indexes. What are some similarities and differences?

Some similarities between unique and non-unique indexes include:

  • Both indexes improve the performance of SQL queries by providing a faster way to lookup the desired data.
  • Both indexes use an additional data which requires more storage space which impacts write performance.
  • Both indexes can be created on one or more columns of a table

Some differences between unique and non-unique indexes include:

  • A unique index enforces the uniqueness of the indexed columns, meaning that no duplicate values are allowed in the indexed columns. A non-unique index allows duplicate values in the indexed columns.
  • A unique index can be used to enforce the primary key of a table, but a non-unique index cannot.
  • A unique index can have a maximum of one NULL value in the indexed columns, but a non-unique index can have multiple NULLs

SQL Question 8: Find the Total Revenue Per Product

Zeta Global sells a variety of products, and you are given a database with two tables - one containing product sales and another one containing product details. The "sales" table contains sales date, product_id, and units sold at what price. The "products" table contains product_id and product_name. You are required to write a query that returns the total revenue generated from each product.

Below are the structure and some data from the "sales" and "products" tables:

Example Input:
Example Input:
Example Output:


You can calculate the total revenue per product by multiplying units_sold with price_per_unit grouped by product_id. You can then join this with the products table to get the product_name.

This query calculates the total revenue (units_sold * price_per_unit) for each product, ordered by revenue in descending order. The JOIN operation combines rows from the sales and products tables based on their shared field, product_id.

SQL Question 9: Analyzing Customer and Purchase Data

Suppose you have been given two tables, "Customers" and "Purchases". The "Customers" table contains information about all the customers of Zeta Global, including their customer_id, first_name, last_name, and registration_date. The "Purchases" table contains details about each purchase, including purchase_id, customer_id (who made the purchase), product_id, purchase_date, and purchase_amount.

Your task is to write an SQL query to get a list of each customer along with their total purchase amount. Include only those customers who registered in 2020 in the output.

Example Input:


Example Input:



Below is an SQL query written for the PostgreSQL database to answer the question:

This SQL query retrieves the customer_id, customer's full_name, and their total purchase_amount by joining the "Customers" and "Purchases" tables on the customer_id, and filtering the data for customers registered in 2020 only. The SUM function is used to get the total purchase_amount of each customer.

Because join questions come up routinely during SQL interviews, try this Snapchat Join SQL question: Snapchat Join SQL question

SQL Question 10: How does a cross join differ from a natural join?

Imagine you are organizing a party and have two database tables: one table of people you want to invite and another list of food items you want to serve.

A cross join would be like inviting every person on your list to the party and serving them every food item on the menu, regardless of whether they like the food or not. So, if you had 10 people on your invite list and 5 food items on the menu, you would generate all 50 different combinations of people and food (10 x 5 = 50).

On the other hand, a natural join would be like inviting only the people who like the food items on the menu (based on doing a inner/left/right/outer JOIN on a common key like ).

Zeta Global SQL Interview Tips

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 earlier Zeta Global SQL interview questions, you should also solve the 200+ FAANG SQL Questions on DataLemur which come from companies like Microsoft, Google, Amazon, and tech startups. DataLemur Questions

Each interview question has hints to guide you, step-by-step solutions and crucially, there is an interactive coding environment so you can right in the browser run your SQL query answer and have it checked.

To prep for the Zeta Global SQL interview you can also be useful to practice interview questions from other tech companies like:

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

SQL tutorial for Data Scientists & Analysts

This tutorial covers things like using LIKE and handling date/timestamp data – both of these pop up often in SQL job interviews at Zeta Global.

Zeta Global Data Science Interview Tips

What Do Zeta Global Data Science Interviews Cover?

Besides SQL interview questions, the other types of questions covered in the Zeta Global Data Science Interview are:

  • Probability & Statistics Questions
  • Coding Questions in Python or R
  • Analytics and Product-Metrics Questions
  • ML Modelling Questions
  • Behavioral Interview Questions

Zeta Global Data Scientist

How To Prepare for Zeta Global Data Science Interviews?

The best way to prepare for Zeta Global Data Science interviews is by reading Ace the Data Science Interview. The book's got:

  • 201 Interview Questions from FAANG tech companies
  • A Refresher on Python, SQL & ML
  • Great Reviews (900+ 5-star reviews on Amazon)

Ace the Data Science Interview by Nick Singh Kevin Huo