At Just Eat Takeaway, SQL is crucial for analyzing customer ordering patterns for targeted marketing, and managing restaurant information for optimized delivery. That's why Just Eat Takeaway often tests SQL coding questions in interviews for Data Science, Analytics, and & Data Engineering jobs.
So, to help you practice for the Just Eat Takeaway SQL interview, we'll cover 9 Just Eat Takeaway SQL interview questions – able to solve them?
Just Eat Takeaway would like to determine the monthly average order value of each restaurant listed in their platform. You are provided with two datasets - 'orders' and 'restaurants'. The 'orders' table contains information about each order including the order_id, restaurant_id, order_date, and total_order_value. The 'restaurants' table contains information about each restaurant including the restaurant_id and its name.
Write a SQL query using window function to calculate the average order value for each restaurant, month by month.
order_id | restaurant_id | order_date | total_order_value |
---|---|---|---|
10085 | 4000 | 06/08/2022 | 35.00 |
21075 | 5000 | 06/10/2022 | 22.80 |
13050 | 6000 | 06/18/2022 | 16.90 |
17150 | 4000 | 07/01/2022 | 45.30 |
19100 | 5000 | 07/05/2022 | 25.40 |
restaurant_id | name |
---|---|
4000 | McDonald's |
5000 | KFC |
6000 | Burger King |
The query first calculates the monthly averages using a window function in the CTE. This CTE is then joined with the table in the main query to get the names of the restaurants. The results are sorted by month and then by restaurant name.
p.s. Window functions show up super frequently during SQL interviews, so practice the 27+ window function questions on DataLemur
In Just Eat Takeaway, you have the responsibility to help business partners enhance their operations. To this end, you want to find all customers who placed an order with the following attributes from the and tables:
For each qualifying customer, return their full name, email, and total amount spent on orders after the given date.
order_id | customer_id | restaurant_name | order_date | total_amount |
---|---|---|---|---|
0001 | 1111 | Pizza Heaven | 05/02/2022 | £35 |
0002 | 1112 | Burger King | 05/01/2022 | £20 |
0003 | 1112 | Pizza Heaven | 05/02/2022 | £40 |
0004 | 1113 | Pizza Hut | 05/03/2022 | £25 |
0005 | 1111 | Pizza Heaven | 05/02/2022 | £45 |
customer_id | full_name | |
---|---|---|
1111 | John Doe | john.doe@example.com |
1112 | Jane Smith | jane.smith@example.com |
1113 | Tom Lee | tom.lee@example.com |
This SQL query filters out customers from the and tables based on the desired conditions, then sums up the total amount that each customer has spent on their orders. It uses the clause to combine and tables, and the clause to filter the records. Finally, is used to group the results by customer id.
In database schema design, a one-to-one relationship between two entities is characterized by each entity being related to a single instance of the other. An example of this is the relationship between a US citizen and their social-security number (SSN) - each citizen has one SSN, and each SSN belongs to one person.
On the other hand, a one-to-many relationship is when one entity can be associated with multiple instances of the other entity. A teacher's relationship with their classes is an example of this - a teacher can teach many classes, but each class is only associated with one teacher.
Just Eat Takeaway, an online food delivery marketplace, is interested in understanding its click-through rates. They are specifically interested in seeing how often users who visit their website actually click on the food items (representing a digital ad) to get more details and then finally place an order (conversion).
For this analysis, we will need two tables. The table keeps a record of each user's visit to the website, and the table keeps a record of each food order placed. We assume that a user has clicked through if they have visited and placed an order.
visit_id | user_id | click_date | food_id |
---|---|---|---|
8901 | 567 | 07/21/2022 00:00:00 | 30001 |
9032 | 803 | 07/22/2022 00:00:00 | 20001 |
7550 | 234 | 07/24/2022 00:00:00 | 10001 |
8930 | 567 | 07/26/2022 00:00:00 | 20001 |
9352 | 678 | 07/29/2022 00:00:00 | 30001 |
order_id | user_id | order_date | food_id |
---|---|---|---|
4501 | 567 | 07/21/2022 00:00:00 | 30001 |
4802 | 234 | 07/24/2022 00:00:00 | 10001 |
5290 | 678 | 07/29/2022 00:00:00 | 30001 |
6002 | 567 | 07/26/2022 00:00:00 | 20001 |
6017 | 803 | 07/22/2022 00:00:00 | 20001 |
This query first calculates the total number of visits and the number of times a user clicked on a food item and made an order on the same day. Then it calculates the click-through rate by dividing the count of click and orders by the total visits. These are joined in the FROM clause without a join condition, creating a Cartesian product (cross join), since there is only one row in each subquery, it leads to their combination into one row.
To solve a similar problem about calculating rates, try this TikTok SQL question on DataLemur's interactive coding environment:
A NULL value represents a missing or unknown value. It is different from a zero or a blank space, which are actual values. It is important to handle NULL values properly in SQL because they can cause unexpected results if not treated correctly.
Given the following tables for Just Eat Takeaway's customers and orders, generate a report calculating the average order price in each city.
The table contains details about each customer including their delivery address, and the table contains details about each order including the total price. Use the field from the table, and the field from the table.
customer_id | first_name | last_name | city | postcode |
---|---|---|---|---|
001 | John | Doe | New York | 10001 |
002 | Jane | Smith | Los Angeles | 90001 |
003 | Mary | Johnson | Chicago | 60007 |
004 | James | Brown | San Francisco | 94101 |
005 | Robert | Davis | New York | 10001 |
order_id | customer_id | total_price |
---|---|---|
9001 | 001 | 20.00 |
9002 | 002 | 25.75 |
9003 | 003 | 30.50 |
9004 | 004 | 19.00 |
9005 | 001 | 27.00 |
This query joins the and tables based on the field, which is common in both tables. It then groups the results by , and for each city it calculates the average of the field from the table. The function is used to calculate the average order price.
city | avg_order_price |
---|---|
New York | 23.50 |
Los Angeles | 25.75 |
Chicago | 30.50 |
San Francisco | 19.00 |
The result of the query is a list of cities along with the corresponding average order price.
{#Question-7}
The operator merges the output of two or more statements into a single result set. The two SELECT statements within the UNION must have the same number of columns and the data types of the columns are all compatible.
For example, if you were a Data Analyst on the marketing analytics team at Just Eat Takeaway, this statement would return a combined result set of both Just Eat Takeaway's Google and Facebook ads that have more than 300 impressions:
Just Eat Takeaway has a variety of dishes from different cuisines. For a marketing exercise, they want to target customers who have ordered Italian food in the past. The task is to identify customers whose orders contain the word ‘Italian’ from the table.
customer_id | name | sign_up_date | |
---|---|---|---|
213 | John Doe | johndoe@example.com | 01/12/2020 |
127 | Jane Doe | janedoe@example.com | 20/10/2021 |
176 | Mary Jane | mary@doe.com | 15/03/2020 |
109 | Peter Parker | peter@parker.com | 27/05/2022 |
order_id | customer_id | order_date | foods_ordered | total_amount |
---|---|---|---|---|
501 | 213 | 16/09/2022 | Pizza Margherita, Gelato | 30.5 |
502 | 127 | 06/10/2022 | Butter Chicken, Rice | 25 |
503 | 176 | 12/09/2022 | Spaghetti Bolognese, Tiramisu | 28 |
504 | 109 | 20/10/2022 | Sushi, Miso Soup | 36 |
This query joins and tables on . The WHERE clause filters out the rows from the joined table where contains the word 'Italian'. We use the LIKE keyword and the '%' wildcard to match any sequence of characters before and after 'Italian'. This will return the list of customers who have ordered Italian food at least once.
Write a SQL query to analyze the table and join it with the table. From the end result, it should be possible to determine the total amount spent by each customer based on their location.
The table has the following fields:
The table has the following fields:
order_id | customer_id | order_date | total_amount | restaurant_id |
---|---|---|---|---|
1 | 101 | 2022-06-08 | 30.99 | 201 |
2 | 102 | 2022-06-10 | 25.50 | 202 |
3 | 101 | 2022-06-18 | 28.75 | 203 |
4 | 103 | 2022-07-26 | 15.00 | 201 |
5 | 102 | 2022-07-05 | 30.50 | 202 |
customer_id | customer_name | customer_location |
---|---|---|
101 | John Doe | London |
102 | Jane Doe | Berlin |
103 | Bob Smith | Amsterdam |
You can answer this question by writing a SQL select query that groups the combined orders and customers data by .
This SQL query joins the and tables based on matching . The orders are then grouped by customer location, and the total order amount is summed for each group (location). The result set will give the total amount spent by customers in each location.
Because join questions come up so often during SQL interviews, practice this interactive Snapchat Join SQL question:
Assuming that you've already got basic SQL skills, the next best tip we have to prepare for the Just Eat Takeaway SQL interview is to solve as many practice SQL interview questions as you can! In addition to solving the earlier Just Eat Takeaway SQL interview questions, you should also solve the 200+ SQL exercises on DataLemur which come from companies like Amazon, Microsoft, Meta, and smaller tech companies.
Each interview question has multiple hints, step-by-step solutions and best of all, there's an interactive SQL code editor so you can right in the browser run your query and have it executed.
To prep for the Just Eat Takeaway SQL interview you can also be a great idea to solve SQL problems from other tech companies like:
But if your SQL foundations are weak, don't worry about diving straight into solving questions – go learn SQL with this interactive SQL tutorial.
This tutorial covers SQL topics like CASE/WHEN/ELSE statements and removing NULLs – both of which pop up often during Just Eat Takeaway SQL assessments.
In addition to SQL query questions, the other types of questions to practice for the Just Eat Takeaway Data Science Interview are:
To prepare for Just Eat Takeaway Data Science interviews read the book Ace the Data Science Interview because it's got: