Home β€Ί Interview Questions β€Ί What is the difference between window functions an…

What is the difference between window functions and aggregate functions?

🟑 Medium Conceptual Junior level
1Times asked
May 2026Last seen
May 2026First seen

πŸ’‘ Model Answer

Aggregate functions (e.g., SUM, COUNT, AVG) collapse a set of rows into a single value and are used in the GROUP BY clause. They return one row per group.

Window functions, on the other hand, perform calculations across a set of rows related to the current row (the window) while preserving the original row count. They are written with OVER() and can include PARTITION BY and ORDER BY clauses. Window functions allow you to compute running totals, moving averages, rankings, and more without collapsing rows.

In short, aggregates reduce the number of rows; window functions enrich each row with additional computed values.

This answer was generated by AI for study purposes. Use it as a starting point β€” personalize it with your own experience.

🎀 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers β€” invisible to screen sharing.

Get Assisting AI β€” Starts at β‚Ή500