Home › Interview Questions › Aggregation Interview Questions

Aggregation Interview Questions

27 real Aggregation questions asked in live technical interviews — each with a model answer. Updated weekly.

🎤 Auto-captured by Assisting AI during live interviews

These Aggregation interview questions were captured from real interviews by candidates using Assisting AI. Each links to a full model answer. For real-time help during your own interview, get Assisting AI from ₹500/day.

Build two PySpark DataFrames, drop duplicates on 'order_id', filter for status == 'Completed', then group by 'customer_id' aggregating sum('amount') and count('order_id'), and finally join to the customers DataFrame to retrieve customer names.🟡 Medium · Coding · Asked 2×What is the difference between using DISTINCT and using GROUP BY with HAVING COUNT > 1 in SQL queries?🟡 Medium · Conceptual · Asked 2×What does this SQL query do?🟢 Easy · Conceptual · Asked 2×Write a Python function that uses a dictionary to sum the 'amount' field per 'customer_id', skipping any None values.🟢 Easy · Coding · Asked 1×How can you retrieve the latest order per customer and filter customers with total spend greater than 500 using SQL?🟡 Medium · Coding · Asked 1×Why doesn't Customer ID 9 appear in the final result when aggregating orders and left joining to customers?🟡 Medium · Conceptual · Asked 1×What is the difference between COUNT(*) and COUNT(column) in SQL?🟢 Easy · Conceptual · Asked 1×Create PySpark DataFrames from the given data, remove duplicate orders using 'order_id', keep only orders with status 'Completed', calculate each customer's total completed order amount and number of completed orders, and join the result with the customers DataFrame to get customer names.🟡 Medium · Coding · Asked 1×Write a pandas pipeline that removes duplicate orders by 'order_id', filters for status 'Completed', and then groups by 'customer_id' to compute the total amount and count of orders.🟡 Medium · Coding · Asked 1×Write PySpark code to filter rows where status is 'success' and aggregate the total amount per customer using groupBy and sum.🟢 Easy · Coding · Asked 1×What is the difference between COUNT(*) and COUNT(email) in SQL?🟢 Easy · Conceptual · Asked 1×Why should the GROUP BY clause include the distance column instead of destination in this query?🟡 Medium · Conceptual · Asked 1×Why would you use a window function instead of a traditional GROUP BY in SQL?🟡 Medium · Conceptual · Asked 1×How would you process 100GB of data in a distributed computing environment? How would you split it into chunks and aggregate the results?🔴 Hard · Conceptual · Asked 1×Given the following orders table, write a Spark SQL query to compute the total amount per store.🟢 Easy · Coding · Asked 1×Explain the recursive CTE query that calculates total salary per employee hierarchy, line by line.🟡 Medium · Conceptual · Asked 1×Explain the workflow of the recursive CTE query that calculates total salary per employee hierarchy.🟡 Medium · Conceptual · Asked 1×Explain Q3, the recursive CTE that walks the org hierarchy and sums salaries.🟡 Medium · Conceptual · Asked 1×How can you find customers who have data for all 12 months in a year using SQL?🟡 Medium · Conceptual · Asked 1×How would you compute a 7‑day rolling average of daily revenue when there can be multiple transactions per day, using transaction timestamps?🟡 Medium · Coding · Asked 1×Write a SQL query to retrieve the top 3 customers by total purchase amount in the last 6 months.🟡 Medium · Conceptual · Asked 1×What is the error in the following SQL query that finds employees working on projects greater than or equal to the average number of projects per employee?🟢 Easy · Debugging · Asked 1×What is a better approach to find employees working on projects greater than or equal to the average number of projects per employee?🟡 Medium · Conceptual · Asked 1×Write a SQL query that returns the first and last purchase dates for each customer-product pair, only including pairs with at least two completed orders.🟡 Medium · Coding · Asked 1×Explain the following SQL query: SELECT customer_name, COUNT(*) FROM customerTable WHERE CITY_Name LIKE '%Pu%'?🟢 Easy · Conceptual · Asked 1×Give PySpark code to calculate the friend acceptance rate for each date when friend requests were sent. A request is sent if action = 'sent' and accepted if action = 'accepted'. If a request is not accepted, there is no record of it being accepted in the table. The output should only include dates where requests were sent and at least one of them was accepted (acceptance can occur on any date after the request is sent).🟡 Medium · Coding · Asked 1×How would you transform the bronze_user_sessions table into a silver table with aggregated session metrics?🟡 Medium · Conceptual · Asked 1×

🎤 Get Aggregation questions answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500

Browse Other Topics