{
  "id": 8984504,
  "title": "Subqueries and CTEs: Asking a Question Inside a Question",
  "url": "https://urgent.news/2026/09/21/subqueries-and-ctes-asking-a-question-inside-a-question",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-21T19:00:13.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/david_mwandairo_777f888b4/subqueries-and-ctes-asking-a-question-inside-a-question-3lpk"
  },
  "original_language": "en",
  "account": null,
  "summary": "In SQL, subqueries and common table expressions (CTEs) are powerful tools for performing complex queries that cannot be answered in a single pass. A subquery is a query nested inside another query, wrapped in parentheses. The database runs the subquery first, obtaining a result that is then used by the outer query. There are three types of subqueries: scalar, IN, and correlated. A scalar subquery returns a single value, an IN subquery returns a list of values, and a correlated subquery returns a result set that is correlated with the outer query. Examples are provided in the report, demonstrating how subqueries can be used to find the hive with the most honey, hives that have never been harvested, and each hive's most recent harvest.",
  "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."
}