11 Adevinta SQL Interview Questions (Updated 2024)

Updated on

March 1, 2024

At Adevinta, SQL does the heavy lifting for analyzing user interaction data to optimize user experience, and managing large databases to ensure targeted advertising efficiency. That's why Adevinta frequently asks SQL problems during interviews for Data Analytics, Data Science, and Data Engineering jobs.

As such, to help you prepare for the Adevinta SQL interview, this blog covers 11 Adevinta SQL interview questions – able to answer them all?

11 Adevinta SQL Interview Questions

SQL Question 1: Identify Power Users from Customer Database

Adevinta is a company that values its power users, which are classified as customers who made the highest number of purchases within a specific time frame. As an SQL analyst, your task is to write a query to identify these power users. Key informations needed to perform this analysis would be 'user_id', 'product_id', 'purchase_id', and 'purchase_date'.

Below is a snapshot of the table for Adevinta.

Example Input:
purchase_iduser_idproduct_idpurchase_date
1011105100012022-06-18
1032202100022022-07-10
1078202100012022-07-15
1183306100032022-07-22
1105202100042022-08-05

You are expected to write a query that reads this table and finds out the users who have the highest total number of purchases and classify them as power users. The output should have the customer_id, total number of purchases and classification.

Answer:


This PostgreSQL query first uses a common table expression (CTE) named to group the purchases by the and calculate the total number of purchases for each user. Then it selects from this CTE the , , and a derived column that labels each user as a 'Power User' if they have 3 or more total purchases, otherwise it labels them as a 'Regular User'. Lastly, the query orders the results by the total number of purchases in descending order.

To solve a super-customer analysis question on DataLemur's free interactive SQL code editor, try this Microsoft SQL Interview problem: Microsoft SQL Interview Question: Super Cloud Customer

SQL Question 2: User Activity Analytics

Adevinta is a digital marketplace specialist, offering platforms to connect sellers and buyers, presenting a variety of goods and services. A potential dataset, therefore, could relate to user activity, in particular, ad postings on the site.

Let's assume that we have a table called which records every ad posting that a user makes. Now, company management wants to understand user behavior and see if there are any patterns in the frequency of ad postings. More specifically, they want to know, for a given user, which month had the most posting activity between January 2019 and December 2019.

Table Example Input:
activity_iduser_idpost_datead_id
0112302/08/2019 00:00:009836
0245602/10/2019 00:00:007486
0312306/18/2019 00:00:002698
0478907/26/2019 00:00:005623
0545607/05/2019 00:00:001249
0612312/01/2019 00:00:007486

Answer:


Above query is using PARTITION BY to create a window function grouped by and . It performs a count of rows inside each window, effectively counting number of ads each user posted in each month. The WHERE clause is ensuring we only consider data from 2019. The result is sorted by and for ease of reading.

To solve another window function question on DataLemur's free interactive coding environment, try this Google SQL Interview Question: Google SQL Interview Question

SQL Question 3: Can you explain the meaning of database denormalization?

Denormalization is the process of modifying a database schema in a way that deviates from the typical rules of normalization (1NF, 2NF, 3NF, etc.).

Denormalization is often used to improve the performance of a database, particularly when it is being used for reporting and analytical purposes (rather than in an Online Transaction Processing (OLTP) manager).

By duplicating data, denormalization can reduce the number of expensive joins required to retrieve data, which can improve query performance. However, denormalization can also cause problems such as increased data redundancy and the need for more complex update and delete operations.

Adevinta SQL Interview Questions

SQL Question 4: Revenue Analysis by Product Category

Adevinta is a global online classifieds specialist. For this hypothetical scenario, assume we have three tables - 'Users', 'Listings', and 'Transactions'. The 'Users' table includes information about the users listing their items, 'Listings' includes information about the items listed and 'Transactions' includes information about the transactions (buy/sell) happening against each listing.

Our goal is to determine the total revenue generated by product categories in a specific year (e.g., 2022).

Below are the example tables:

'Users' Example:
Column NameDescription
user_idUnique ID of the listing's creator
user_locationLocation of the user

Sample Records:

user_iduser_location
123France
265Spain
362Norway
'Listings' Example:
Column NameDescription
listing_idUnique ID for the listing
user_idThe ID of the user who created the listing
product_categoryCategory of the product
listing_pricePrice at which the item is listed

Sample Records:

listing_iduser_idproduct_categorylisting_price
50001123Electronics150
69852265Automobiles2000
50002362Furniture100
'Transactions' Example:
Column NameDescription
transaction_idUnique ID for the transaction
listing_idThe ID of the listing the transaction is related to
transaction_dateThe date the transaction was executed

Sample Records:

transaction_idlisting_idtransaction_date
6171500012022-06-08
7802698522022-06-10
5293500022022-06-18
6352698522022-07-26
4517698522022-07-05

Answer:

Here is a PostgreSQL query that solves the problem:


This query first joins 'Listings' and 'Transactions' on 'listing_id'. Then, it only considers the transactions made in the year 2022 and finally groups the data by 'product_category' to calculate the total revenue.

SQL Question 5: Are NULLs handled the same as zero's and blank spaces in SQL?

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.

SQL Question 6: Calculating Click Through Conversion Rate

Assume Adevinta, a digital marketplace that offers ads and product listings, wants to track and analyze the click-through conversion rates for their product ads. Specifically, they are interested in finding out the conversion rate of users who viewed a product ad and subsequently added that product to their cart in the same session.

The following table shows a simplified structure of two tables that Adevinta might have: and . The table records each time a user clicks on a product ad, and the table tracks each time a user adds a product to their cart.

Example Input:
click_iduser_idsession_idproduct_idad_click_timestamp
1200105300106/08/2022 10:00:00
2200105300206/08/2022 10:10:00
3150203300306/10/2022 12:00:00
4150989300106/11/2022 15:00:00
5400473300206/18/2022 20:00:00
Example Input:
add_iduser_idsession_idproduct_idcart_add_timestamp
1200105300106/08/2022 10:05:00
2150203300306/10/2022 12:05:00
3200105300206/08/2022 10:15:00
4400473300206/18/2022 20:05:00
5150203300106/10/2022 14:00:00

The objective is to write a SQL query that will provide the overall click-through conversion rate.

Solution:


The above PostgreSQL query first calculates the total number of ad clicks. Then, it calculates the successful clicks - i.e., the instances where a click on an ad was followed by adding the same product to the cart during the same session. Finally, it calculates the conversion rate by dividing the number of successful clicks by the total number of clicks.

To solve a similar SQL problem on DataLemur's free interactive coding environment, solve this Facebook SQL Interview question: Facebook Click-through-rate SQL Question

SQL Question 7: What does / SQL commands do?

The EXCEPT operator is used 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, and it's equivalent operator is called and is available in MySQL and Oracle.

For a tangible example, suppose you were doing an HR Analytics project for Adevinta, and had access to Adevinta's contractors and employees data. Assume that some employees were previously contractors, and vice versa, and thus would show up in both tables. You could use operator to find all employees who never were a contractor using this query:


SQL Question 8: Average Listing Price Per Category

Given the tables and , find out the average listing price per category for all the listings made in the year 2022.

The table has the following columns:

  • : the ID of the listing (integer)
  • : the ID of the user who created the listing (integer)
  • : the ID of the category the listing belongs to (integer)
  • : the price of the listing (float)
  • : the date the listing was created (date)

The table has the following columns:

  • : the ID of the category (integer)
  • : the name of the category (string)
Example Input:
listing_iduser_idcategory_idlisting_pricelisting_date
11011100.002022-01-15
21022500.002022-05-10
31031150.002022-03-20
41043300.002022-07-15
51052600.002022-09-25
Example Input:
category_idcategory_name
1Electronics
2Automotive
3Clothing

Answer:


This query joins the and tables on , filters for listings from the year 2022 using the EXTRACT function, and then uses the GROUP BY clause and AVG function to get the average listing price per category.

SQL Question 9: Join Customer and Order Tables to Find Total Orders Per Customer

In Adevinta, the team needs to understand the customer order patterns to improve their sales strategy. Your task is to write a SQL query that will combine the customer database and the relevant order table to return each customer's ID, name, and the total number of orders they have placed.

In our database, each customer is identified by a unique , and each order has a corresponding and .

Sample tables:

Example Input:

customer_idfirst_namelast_name
1JohnDoe
2JaneSmith
3AliceJohnson
4BobDavis

Example Input:

order_idcustomer_idorder_dateitem
100106/08/2022Laptop
101206/10/2022Mobile phone
102106/18/2022Headphones
103307/26/2022Tablet
104207/05/2022TV

Example Output:

customer_idfirst_namelast_nametotal_orders
1JohnDoe2
2JaneSmith2
3AliceJohnson1
4BobDavis0

Answer:


In this query, we use the clause to combine the and tables. The clause is used to group the results by customer ID, first name, and last name. The function counts the total number of orders per customer. If a customer hasn't placed any orders, will be 0.

Because joins come up so often during SQL interviews, try this interactive Snapchat JOIN SQL interview question: Snapchat Join SQL question

SQL Question 10: In what circumstances might you choose to denormalize a database?

There are several advantages to normalizing a database, including less redundancy, more flexibility, and better performance.

  • Less Redundancy: Normalization reduces redundancy by breaking down a larger, more general table into smaller, more specific tables. This reduces the amount of data that needs to be accessed for queries.

  • More Flexibility: Normalization makes it easier to modify the structure of the database, as there is less redundancy, so it allows you to make changes to one table without affecting others. This makes it easier to adapt the database to changing business needs (a very real reality at Adevinta!)

  • Better Performance: Normalization can improve the performance of the database by reducing the amount of data that needs to be stored and accessed in a single table. This can result in faster query times and better overall performance.

SQL Question 11: Calculate Distance Between Two Points

Given the table that holds the x and y coordinates for points A and B, calculate the distance between these two points for each record using the Euclidean distance formula: sqrt((x2 - x1)² + (y2 - y1)²). Round the result to 2 decimal places.

Example Input:
idpoint_a_xpoint_a_ypoint_b_xpoint_b_y
17.63.84.29.1
23.57.38.91.6
36.28.42.63.1
Example Output:
iddistance
16.90
28.13
36.44

Answer:


This query calculates the Euclidean distance for each record in the table using the provided coordinates for points A and B. The function is used to square the difference in x and y coordinates between the two points, and the function is used to get the square root of the summation. This result is then rounded to 2 decimal places using the function.

To practice a very similar question try this interactive Alibaba Compressed Mean Question which is similar for using mathematical functions and rounding results or this Google Median Google Search Frequency Question which is similar for employing numerical operations on given data.

How To Prepare for the Adevinta SQL Interview

The key to acing a Adevinta SQL interview is to practice, practice, and then practice some more! Beyond just solving the above Adevinta SQL interview questions, you should also solve the 200+ tricky 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 multiple hints, full answers and best of all, there is an online SQL code editor so you can instantly run your SQL query and have it checked.

To prep for the Adevinta SQL interview it is also a great idea to practice SQL problems from other tech companies like:

However, if your SQL coding skills are weak, forget about diving straight into solving questions – go learn SQL with this SQL tutorial for Data Scientists & Analysts.

DataLemur SQL Tutorial for Data Science

This tutorial covers SQL topics like inner vs. outer JOIN and LAG window function – both of which show up often in SQL job interviews at Adevinta.

Adevinta Data Science Interview Tips

What Do Adevinta Data Science Interviews Cover?

Beyond writing SQL queries, the other types of questions to prepare for the Adevinta Data Science Interview are:

Adevinta Data Scientist

How To Prepare for Adevinta Data Science Interviews?

To prepare for Adevinta 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 Python, SQL & ML
  • over 900+ reviews on Amazon & 4.5-star rating

Ace the DS Interview

© 2024 DataLemur, Inc

Career Resources

Free 9-Day Data Interview Crash CourseFree SQL Tutorial for Data AnalyticsSQL Interview Cheat Sheet PDFUltimate SQL Interview GuideAce the Data Job Hunt Video CourseAce the Data Science InterviewBest Books for Data Analysts