At Zebra Technologies, SQL is used quite frequently for analyzing logistics data, and for analyzing RFID data collected from the factory floor. That's why Zebra Technologies LOVES to ask SQL questions in interviews for Data Science, Data Engineering and Data Analytics jobs.
To help you study for the Zebra Technologies SQL interview, we've curated 10 Zebra Technologies SQL interview questions – can you solve them?
As a data analyst at Zebra Technologies, you've been given access to the company's database. This database hosts several tables related to our customers' data including their purchasing habits, the products they buy, and the frequency of their purchases.
In this context, a power customer for Zebra Technologies is a customer who purchases above $500 worth of goods monthly. Your task is to create a SQL query that can extract data from Zebra Technologies' customer database to identify these power customers.
Here's our raw data:
purchase_id | customer_id | purchase_date | product_id | purchase_amount |
---|---|---|---|---|
1001 | 200 | 01/08/2022 00:00:00 | 5001 | 300 |
1002 | 123 | 01/08/2022 00:00:00 | 6002 | 600 |
1003 | 200 | 02/10/2022 00:00:00 | 5002 | 300 |
1004 | 345 | 01/08/2022 00:00:00 | 2345 | 700 |
1005 | 200 | 03/26/2022 00:00:00 | 1701 | 150 |
customer_id | first_name | last_name |
---|---|---|
123 | John | Doe |
345 | Jane | Smith |
200 | Bob | Johnson |
Please write a query in PostgreSQL to solve the problem.
Here is an example of a SQL query that could solve this task:
This PostgreSQL query will return the first name and last name of each power customer for the current month. The condition ensures that only purchases made in the current month are accounted for in the query. The condition filters out any customers who haven't made a total purchase amount of more than $500 during the current month.
To solve a related super-user data analysis question on DataLemur's free online SQL coding environment, try this Microsoft Teams Power User SQL Interview Question:
Zebra Technologies is a company focusing on barcode, RFID, and enterprise printing. They also provide supplies such as barcode labels and ribbons, RFID tags, cards and receipt paper, and Synthetic labels.
Suppose you are given a sales data of Zebra technology products, with each row representing a product sold to a client. Your task is to write a SQL query that calculates the average sales per month for each product.
sale_id | client_id | sale_date | product_id | quantity |
---|---|---|---|---|
101 | 123 | 06/08/2022 00:00:00 | 50001 | 3 |
102 | 265 | 06/12/2022 00:00:00 | 69852 | 2 |
103 | 362 | 06/19/2022 00:00:00 | 50001 | 1 |
104 | 192 | 07/26/2022 00:00:00 | 69852 | 5 |
105 | 981 | 07/05/2022 00:00:00 | 69852 | 3 |
month | product_id | avg_sales |
---|---|---|
6 | 50001 | 2 |
6 | 69852 | 2 |
7 | 69852 | 4 |
This SQL query makes use of window functions to compute the average sales per month for every product. is used to group the sales data by month, and is used to further divide the data by product. Then, the function is used with the clause to carry out the computation. This allows the calculation to focus on each subset of data defined by the clause. Hence, it produces the average sales per month for each product.
To practice another window function question on DataLemur's free online SQL coding environment, solve this Amazon SQL Interview Question:
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 ).
Zebra Technologies wants to identify customers who have purchased a specific "Mobile Computer" product and live in a certain region (for example, "North America"). The goal is to run a promotional campaign targeting these specific customers.
Write a query to filter customers who have purchased the Mobile Computer and reside in North America.
Given the tables below:
customer_id | first_name | last_name | region | |
---|---|---|---|---|
1001 | John | Doe | johndoe@example.com | North America |
1002 | Jane | Smith | janesmith@example.com | Europe |
1003 | Jack | Brown | jackbrown@example.com | Asia |
1004 | Lisa | White | lisawhite@example.com | North America |
1005 | Tom | Black | tomblack@example.com | South America |
order_id | customer_id | product | date |
---|---|---|---|
5678 | 1001 | Mobile Computer | 2022-08-26 |
9101 | 1002 | Thermal Printer | 2022-08-27 |
1121 | 1003 | Barcode Scanner | 2022-08-28 |
3141 | 1004 | Mobile Computer | 2022-08-29 |
5161 | 1005 | Mobile Computer | 2022-08-30 |
You can solve this question with a simple SQL SELECT statement combined with a WHERE clause that uses the AND operator to include multiple conditions.
This query first joins the customer and orders table based on the customer_id, which is the common field. It then filters the customers based on the region and product they purchased. The resulting output will display the customer_id, first_name, last_name, and email of the customers who live in North America and have purchased a Mobile Computer.
Stored procedures in SQL are like recipes in a cookbook. Just like a recipe tells you the ingredients and instructions for making a particular dish, a stored procedure tells the DBMS the logic/statements needed to perform a specific task. Just like you can use a recipe to make the same dish over and over again, you can use a stored procedure to repeat the same task multiple times with different input parameters (which is why stored procedures are so damn useful!).
Say you were a Data Analyst working on a HR analytics project. A common sub-task you might have to do is calculate the average salary for a given department at Zebra Technologies, which would be perfect for a stored procedure:
To call this stored procedure and find the average salary for the Data Science department you'd execute a query like this:
Zebra Technologies provides a variety of hardware such as printers, scanners, mobile computers, etc. As an SQL developer, your task is to find the average usage time of the equipment used by employees for a period of a week. Assume you have access to an 'equipment_usage' table with 'user_id', 'equipment_id', 'usage_start_time' and 'usage_end_time' columns.
row_id | user_id | equipment_id | usage_start_time | usage_end_time |
---|---|---|---|---|
1 | 10 | 101 | 2022-08-02 08:00:00 | 2022-08-02 10:00:00 |
2 | 11 | 101 | 2022-08-02 11:00:00 | 2022-08-02 14:00:00 |
3 | 10 | 104 | 2022-08-03 09:00:00 | 2022-08-03 15:00:00 |
4 | 11 | 103 | 2022-08-03 10:00:00 | 2022-08-03 11:30:00 |
5 | 10 | 102 | 2022-08-04 08:00:00 | 2022-08-04 12:00:00 |
You should write an SQL query that gives the average usage time per equipment for each user in hours.
This query works by first calculating the usage time for each row by subtracting the 'usage_start_time' from the 'usage_end_time'. It then uses the 'EXTRACT' function to convert the time interval to seconds ('EPOCH'), which is then divided by 3600 to convert it to hours. The 'AVG' function is then used to calculate the average time usage per equipment for each user.
To practice a very similar question try this interactive Amazon Server Utilization Time Question which is similar for calculating total usage time.
A UNIQUE constraint ensures that all values in a column are different. It is often used in conjunction with other constraints, such as NOT NULL, to ensure that the data meets certain conditions.
For example, if you had Zebra Technologies employee data stored in a database, here's some constraints you'd use:
In the Zebra Technologies employee example, the UNIQUE constraint is applied to the "email" field to ensure that each employee has a unique email address. This helps to ensure the integrity of the data in the database and prevents errors that could occur if two employees had the same email address.
Zebra Technologies is a company that sells barcode readers, printers, RFID tags, and other related inventory tracking systems. As a data analyst for Zebra Technologies, you are tasked to analyze the sales for their products.
For each product category, find out the total units sold, maximum units sold in a single sale and the average number of units sold per sale.
Consider the following tables:
sale_id | product_id | sale_date | units_sold |
---|---|---|---|
101 | P1001 | 01/05/2022 | 50 |
102 | P1002 | 01/07/2022 | 75 |
103 | P1001 | 01/08/2022 | 100 |
104 | P2001 | 01/10/2022 | 60 |
105 | P2001 | 01/15/2022 | 30 |
106 | P3001 | 01/20/2022 | 40 |
product_id | product_category |
---|---|
P1001 | Printers |
P1002 | Printers |
P2001 | Barcode Readers |
P3001 | RFID Tags |
Using SQL, the following query will help us solve the problem:
This query will join the 'sales' and 'products' tables on 'product_id', and group the results by 'product_category'. For each category, it will compute the total, maximum and average units sold. Using these analytics, Zebra Technologies can gain insights into their sales performance across different product categories.
Zebra Technologies wants to send out a marketing email to all of their customers that have email addresses with the domain . As a SQL developer for Zebra, your job is to fetch all records of customers whose email suits this pattern.
Assume there's a table with fields , , , and in your database.
customer_id | first_name | last_name | |
---|---|---|---|
9462 | John | Doe | john@gmail.com |
5723 | Jane | Roe | jane@gmail.com |
4653 | Adam | Boe | adam@yahoo.com |
3921 | Sophie | Coe | sophie@hotmail.com |
2754 | Ben | Foe | ben@gmail.com |
This query would return all records from the database where the field ends with , thus allowing Zebra Technologies to target these specific customers for their marketing email.
customer_id | first_name | last_name | |
---|---|---|---|
9462 | John | Doe | john@gmail.com |
5723 | Jane | Roe | jane@gmail.com |
2754 | Ben | Foe | ben@gmail.com |
Both the and window functions are used to access a row at a specific offset from the current row.
However, the function retrieves a value from a row that follows the current row, whereas the function retrieves a value from a row that precedes the current row.
Often, the offset for both functions is 1, which gives access to the immediately following/preceding row. Here's a SQL query example:
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. Beyond just solving the earlier Zebra Technologies SQL interview questions, you should also solve the 200+ SQL Interview Questions on DataLemur which come from companies like Microsoft, Google, and Facebook.
Each DataLemur SQL question has multiple hints, fully explained answers along with a discussion board to see how others solved it and most importantly, there is an interactive SQL code editor so you can easily right in the browser your SQL query and have it executed.
To prep for the Zebra Technologies SQL interview it is also a great idea to practice interview questions from other tech companies like:
However, if your SQL query skills are weak, forget about diving straight into solving questions – strengthen your SQL foundations with this interactive SQL tutorial.
This tutorial covers SQL concepts such as joining a table to itself and RANK() window functions – both of these pop up frequently during Zebra Technologies interviews.
Besides SQL interview questions, the other topics to prepare for the Zebra Technologies Data Science Interview are:
To prepare for Zebra Technologies Data Science interviews read the book Ace the Data Science Interview because it's got: