{
  "id": 15427644,
  "title": "SQL CONCEPTS - Window Functions, Joins, Common Table Expressions & Subqueries",
  "url": "https://urgent.news/2026/10/18/sql-concepts-window-functions-joins-common-table-expressions",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-18T14:44:07.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/thegichanga/sql-concepts-window-functions-joins-common-table-expressions-subqueries-n7m"
  },
  "original_language": "en",
  "account": null,
  "summary": "SQL window functions are a powerful tool for performing calculations across a set of rows related to the current row. These functions return one output row per input row, making them useful for tasks such as ranking, cumulative totals, and moving averages. Examples of window functions include ROW_NUMBER(), RANK(), DENSE_RANK(), NTILE(), LAG(), LEAD(), FIRST_VALUE(), LAST_VALUE(), SUM(), AVG(), COUNT(), MIN(), and MAX(). ROW_NUMBER() is particularly useful for assigning a unique sequential number to each row within an ordered partition, while RANK() and DENSE_RANK() assign ranks to rows based on a specified order, with DENSE_RANK() handling ties differently by not leaving gaps in the ranking sequence. NTILE() divides an ordered result set into a specified number of equal groups, assigning a group number to each row. Meanwhile, LAG() and LEAD() allow access to data from previous or subsequent rows within the same result set, which can be used for comparison purposes, such as calculating the difference in sales between consecutive months.",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}