SShortSingh.
Back to feed

SQL Window Functions vs Aggregate Functions: Key Differences Explained

0
·5 views

A technical guide published on DEV Community breaks down the core difference between aggregate and window functions in SQL for beginner and intermediate users. Aggregate functions like SUM() and COUNT() collapse multiple rows into a single result per group, changing the granularity of the data. Window functions perform the same calculations but retain every original row, attaching the result to each one instead of merging them. The distinction is illustrated using side-by-side SQL queries on a small product sales dataset, showing how OVER (PARTITION BY ...) syntax works without requiring a GROUP BY clause. The guide aims to help developers understand when to use each approach, particularly when individual row detail must be preserved alongside group-level totals.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Builds Free Sudoku API Using Rust and WebAssembly for Speed and Portability

A developer has launched a free public Sudoku generation API called Sudoku100, with its core engine written in Rust and compiled to WebAssembly. The system uses a backtracking algorithm to fill a 9x9 grid with randomized candidate digits, then removes cells based on a difficulty target ranging from beginner to extreme. Puzzles at harder difficulty levels undergo a uniqueness check to ensure only one valid solution exists, preventing poor user experience. Compiling Rust to WebAssembly allows the same binary to run both in the browser and on the server, ensuring consistent puzzle output across environments. The developer chose WebAssembly specifically because Sudoku generation is CPU-intensive, making compiled code significantly faster than interpreted JavaScript at scale.

0
ProgrammingDEV Community ·

Developer ships bug that shrank 1080p video to 480p in the name of quality

A developer building a client-side video compression tool discovered a critical bug that caused a 1080p, 30fps clip to be downscaled to 480×270 resolution — ostensibly to preserve quality. The flaw stemmed from using a bits-per-pixel threshold designed for first-generation camera footage, which does not account for videos already compressed by messaging apps or prior exports. The tool's resolution-ladder logic read a re-encoded clip's naturally low bitrate as quality damage, then compounded the error by running the ladder against an already-reduced bitrate budget. In one case, a 77.5 MB source was downscaled from 1858×1660 to 806×720 just to achieve a pixel density higher than the original already had. The developer, who built the tool solo over roughly two weeks, publicly documented all six bugs shipped during that period.

0
ProgrammingDEV Community ·

Developer Builds Free AI Tool to Help Learners Escape Tutorial Hell

A developer on DEV Community has created a free web tool called SkillPilot aimed at helping learners overcome 'tutorial hell', a common cycle of consuming courses without making real progress. The tool asks users to input their target goal, current skill level, and available weekly hours, then generates a personalised five-stage learning path. The path specifies what to learn, what projects to build, and what to skip, reducing the decision fatigue that often stalls self-taught learners. SkillPilot requires no account or payment to use and is currently available online.

0
ProgrammingDEV Community ·

Developer builds Tree-sitter syntax highlighting for Monkey language in Neovim

A developer has begun building a full development environment for Monkey, a small interpreted programming language originally created while learning Go from the book 'Writing An Interpreter In Go'. The project's first step focuses on adding syntax highlighting using Tree-sitter, a widely adopted parsing library that produces real syntax trees and handles incomplete or invalid code gracefully. Monkey supports core features like integers, booleans, functions as first-class citizens, closures, and built-in utilities such as len() and puts(). The Tree-sitter grammar covers all Monkey constructs, is tested against a corpus, and is integrated into Neovim. Future phases of the project plan to add LSP support and eventually use Monkey to solve an Advent of Code problem.