HomeInterview QuestionsAggregation Interview Questions

Aggregation Interview Questions

33 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.

Write a query to find the second highest salary.🟢 Easy · Coding · Asked 2×Write a SQL query to retrieve the revenue for the previous year.🟡 Medium · Coding · Asked 1×How do you fetch the second highest value in a table using a subquery?🟡 Medium · Coding · Asked 1×Suppose you're given a dataset with 10 million rows and you need to perform a complex query that involves aggregating data from multiple tables. How would you optimize the query for better performance?🟡 Medium · Conceptual · Asked 1×Write an SQL query to display Employee Name, Department Name, and Salary, and another query to find the third highest salary from the Employee table.🟡 Medium · Coding · Asked 1×Write an SQL query to count the number of employees in each department.🟢 Easy · Coding · Asked 1×Write an SQL query to retrieve all employees whose salary exceeds the company's average salary.🟡 Medium · Coding · Asked 1×Write an SQL query to find the second highest distinct salary in the Employee table.🟡 Medium · Coding · Asked 1×Write an SQL query to find the second highest distinct salary from the employee table.🟡 Medium · Coding · Asked 1×Write a simple SQL query to fetch the third highest salary from the employee table.🟡 Medium · Coding · Asked 1×Is a GROUP BY statement valid if there are no aggregate functions?🟢 Easy · Conceptual · Asked 1×Is it possible to implement without GROUP BY?🟢 Easy · Conceptual · Asked 1×Find the top three products in each category.🟡 Medium · Coding · Asked 1×Given a table SCORE(ball INTEGER, score INTEGER) with ball numbers and scores, write a SQL query to calculate the average score per over.🟡 Medium · Coding · Asked 1×List employees grouped by department who receive the second half of their salary.🟡 Medium · Coding · Asked 1×When is GROUP BY not needed when using COUNT(*)?🟡 Medium · Conceptual · Asked 1×If we are using aggregation, do we need a HAVING clause?🟡 Medium · Conceptual · Asked 1×When filtering results by context, for what purpose do we use aggregation?🟡 Medium · Conceptual · Asked 1×Why do we use aggregation functions in SQL queries?🟢 Easy · Conceptual · Asked 1×Explain the following SQL query: SELECT customer_name, COUNT(*) FROM customerTable WHERE CITY_Name LIKE '%Pu%'🟢 Easy · Conceptual · Asked 1×List the top 3 departments by revenue.🟡 Medium · Coding · Asked 1×Which department ranks third in revenue?🟡 Medium · Coding · Asked 1×Calculate the average billing commission by department.🟡 Medium · Coding · Asked 1×For each month, compute the patient visit rate, revenue requirement, and average billing per patient.🔴 Hard · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed in the year 2025, but only for customers who placed more than five orders.🟡 Medium · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed during the year 2025, including only customers whose total orders exceed five.🟡 Medium · Coding · Asked 1×For each customer ID, write a SQL query that returns the total number of orders they placed in 2025, but only if that total is greater than five.🟡 Medium · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed in 2025, accounting for customers who may place multiple orders on the same day.🟡 Medium · Coding · Asked 1×Given a table where a business has multiple customers, write a SQL query that returns each customer ID and the total number of orders they placed in 2025, filtering only customers with more than five orders.🟡 Medium · Coding · Asked 1×When using an inner join, we get three successful counts instead of the total count. Will we then get the count?🟡 Medium · Conceptual · Asked 1×Provide PySpark code to compute the acceptance rate per date based on the given table and code.🟡 Medium · Coding · Asked 1×Need PySpark code to compute acceptance rate per date.🟡 Medium · Coding · 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×

🎤 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