8 Grab SQL Interview Questions (Updated 2024)

Updated on

March 1, 2024

At Grab Holdings, SQL does the heavy lifting for extracting and analyzing ride-sharing data, and for managing customer, driver, and transaction databases. Because of this, Grab LOVES to ask SQL coding questions during interviews for Data Science, Analytics, and & Data Engineering jobs.

As such, to help you ace the Grab SQL interview, here’s 8 Grab Holdings SQL interview questions – can you solve them?

8 Grab Holdings SQL Interview Questions

SQL Question 1: Identify Grab's High-Value Users

Given a database of Grab's rides data and user information, generate a SQL query that will help identify the users who have taken the maximum number of rides last month. These are the users who are highly important to Grab given their frequent usage of the platform.

Consider a rides database to be structured as follows:

Example Input:

And a users database to be structured like this:

Example Input:

The output should contain the list of users who took the maximum rides in the last month (April).

Example Output:


The SQL query to solve this problem should look something like this:

This query first joins the rides and users tables on the user_id field. It then filters the rides by those which happened in the previous month to the current date. It groups by the user information and counts the number of rides for each user, and finally, orders by the total number of rides in descending order returning the user that has the maximum number of rides. It uses the PostgreSQL built-in functions DATE_TRUNC to round the ride_date to month and DATEADD to get the date of the previous month to the current date.

To practice a similar customer analytics SQL question where you can code right in the browser and have your SQL code instantly graded, try this Walmart Labs SQL Interview Question: Walmart SQL Interview Question

SQL Question 2: Analyze Grab Ride Ratings Per Month

Assuming Grab wishes to analyze driver ratings over time, and you are provided with a table of ride reviews where each row represents a review submitted by a passenger for a particular ride. Write a SQL query to calculate the average star rating for each driver for each month.

Consider the table as follows:

Example Input:

Your query should return, for each and , the average for the rides they drove that month.

Example Output:


The query is using a statement to group the data by both and . It's using the function to calculate the average star rating for each group. The function is used to convert the into a format, and the is optimizing the output, making it easier to read.

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

SQL Question 3: What is the role of the constraint in SQL?

A is like a secret code that unlocks the door to another table. It's a field in one table that points to the (the master key) in another table. This helps keep the data in your database organized and tidy, because it won't let you add new rows to the table unless they have the correct secret code (a corresponding entry in the table).

It's also like a special bond between the two tables - if you try to delete the data, the will be like "Whoa, hold on! I still need that information!" and prevent the deletion from happening.

Grab Holdings SQL Interview Questions

SQL Question 4: Calculate Click-through Conversion Rate for Grab

As a data analyst at Grab, you're asked to analyze the click-through conversion rate of the ads that the company has been running. The click-through conversion rate is calculated as the number of users who added a product to the cart after viewing it divided by the total number of clicks the ad received.

Two tables provide relevant data:

  • Table:

    6171123A0106/08/2022 00:00:00
    7802265A0206/10/2022 00:00:00
    5293362A0106/18/2022 00:00:00
    6352192A0207/26/2022 00:00:00
    4517981A0307/05/2022 00:00:00
  • Table:

    8532123A0106/08/2022 00:05:00
    9034192A0207/26/2022 00:10:00
    4517362A0106/18/2022 00:30:00

You need to write a query in PostgreSQL to calculate the click-through conversion rate for each ad.


This query works by joining the and tables on both and . It then groups by and calculates the number of unique users who added the product to the cart () and the number of unique clicks (). The click-through conversion rate is calculated by dividing by .

Note that is used to prevent division by zero errors. If is zero, the corresponding will be null.

To solve a similar problem about calculating rates, solve this TikTok SQL question within DataLemur's online SQL coding environment: SQL interview question from TikTok

SQL Question 5: What is the purpose of the UNIQUE constraint?

A UNIQUE constraint ensures that all values in a column are different. This provides uniqueness for the column(s) and helps identify each row uniquely. Unlike primary key, there can be multiple unique constraints defined per table.

SQL Question 6: Grab Ride Analysis

Given the table, write a SQL query to find out the average distance traveled by users by car model for each month in 2020, and only include those car models which have completed more than 1000 rides a month.

Here's some example data in the table:

Example Input:
6171'Model S'1237.2'2020-06-08 10:00:00'
7802'Model 3'26510.2'2020-06-10 14:30:00'
5293'Model S'3625.3'2020-06-18 09:00:00'
6352'Model X'1926.5'2020-07-26 22:00:00'
4517'Model S'9819.1'2020-07-05 07:30:00'


The PostgreSQL query to solve this would be:

This query first limits the data to the year 2020 with the WHERE clause. It then groups the data by month and car model, and filters out those groups which have less than 1000 instances by using the HAVING clause. The SELECT clause computes the rounded average ride distance for each group. Lastly, the results are ordered by month and the average distance in descending order.

SQL Question 7: Can you explain the concept of a cross-join, and their purpose?

A cross-join, also known as a cartesian join, is like a mad scientist's laboratory experiment gone wild. It takes two tables and mixes them together to create a crazy new table with every possible combination of rows from the original tables.

Here's an example:

If you have 20 products and 10 colors, that's 200 rows right there! Cross-joins are great for generating all possible combinations, but they can also create really big tables if you're not careful. Just like a mad scientist, use your powers wisely!

SQL Question 8: Monthly Average Duration of Grab rides

Grab, being a popular ride-hailing service wants to track the monthly average duration of their rides. As the data engineer, your task is to write a SQL query that calculates the average duration of Grab rides per month from the table 'rides' which contains timestamp data for when the ride started and when it ended. The 'rides' table contains the columns: ride_id, user_id, start_time, end_time, and driver_id.

Example Input:

49284503/11/2022 15:05:0003/11/2022 15:25:00200
603185603/20/2022 08:45:0003/20/2022 09:05:00472
10454504/05/2022 10:15:0004/05/2022 10:40:00200
812285604/22/2022 17:00:0004/22/2022 17:45:00472
49814504/30/2022 20:30:0004/30/2022 21:05:00200

Example Output:



This query works by first extracting the month from the start_time column. It then calculates the duration of each trip by subtracting start_time from end_time. This gives the duration in the 'interval' datatype which is then converted to seconds using the EXTRACT(EPOCH FROM interval) function. The result is then divided by 60 to get the duration in minutes. The AVG function is then used to calculate the average duration for each month. Finally, the results are grouped by the month and ordered by the month as well.

Preparing For The Grab SQL Interview

The key to acing a Grab SQL interview is to practice, practice, and then practice some more! Besides solving the above Grab SQL interview questions, you should also solve the 200+ SQL questions from real Data Science & Analytics interviews which come from companies like FAANG and tech startups. DataLemur Question Bank

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

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

In case your SQL coding skills are weak, forget about jumping right into solving questions – improve your SQL foundations with this SQL tutorial for Data Analytics.

Interactive SQL tutorial

This tutorial covers SQL concepts such as WHERE vs. HAVING and finding NULLs – both of which show up often in Grab interviews.

Grab Holdings Data Science Interview Tips

What Do Grab Data Science Interviews Cover?

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

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

Grab Data Scientist

How To Prepare for Grab Data Science Interviews?

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

  • 201 interview questions sourced from FAANG tech companies
  • a crash course covering Stats, ML, & Data Case Studies
  • over 900+ reviews on Amazon & 4.5-star rating

Ace the Data Science Interview Book on Amazon