{
  "id": "1992-june-tech-tips",
  "slug": "1992-june-tech-tips",
  "url": "https://dwillis.github.io/uplink/article/1992-june-tech-tips.html",
  "year": 1992,
  "month": "June",
  "monthNum": 6,
  "headline": "Tech Tips",
  "kicker": "",
  "author_name": "",
  "author_title": "",
  "affiliation": "",
  "summary": "A tutorial on using SQL to categorize continuous data into ranges, demonstrating how creating a range field and grouping by it is more efficient than repeatedly running queries with different WHERE clauses.",
  "keywords": [
    "SQL",
    "database",
    "ranges"
  ],
  "topics": [
    "Data & Databases",
    "Investigative Methods",
    "Health & Environment"
  ],
  "technologies": [
    "SQL"
  ],
  "full_text": "SUBJECT: building ranges in SQL\n\nPROBLEM: CBS Evening News obtained a database of approximately 15,000 children who took a test to measure the lead levels in their bodies. While the database had individual scores ranging from 0 to 45, CBS wanted a report showing the number of children with lead levels of:\n\n10 to 15\n16 to 20\n21 to 25\nover 25\n\nThere was also the possibility that the producer would want further analysis of the children within one or several of the ranges.\n\nSOLUTION: One approach would be to do a count based on the values in the test field:\n\nselect count (*) from leadtest where test >= 10 and test < 16\n\nThis approach requires running the same query, with the test ranges modified, again and again for any further analysis. Also, there would be several pages of reports to sift through. Not a major problem, but not a very elegant solution either.\n\nA better approach is to create a new field called \"range.\" This is a character field 8 bytes long. The next step is to run the following update command:\n\nupdate lead test set range = \"10 to 15\" where test >= 10 and test < 16\n\nAfter this command is run four times for each range, the following query will produce a one page report with all the necessary information.\n\nselect range, count (range) from leadtest group by 1\n\nAny subsequent analysis would use the range field to group the children presumably saving a substantial amount of time. If the table were larger, space could be saved by making the range field a one byte code and using a second table called \"Ranges\" with a code field and the text such as \"10 to 15.\" A join of the two tables would then produce the same results.",
  "provenance": {
    "extracted_by": "anthropic/claude-sonnet-4-6",
    "extracted_at": "2026-07-05",
    "verified": true
  },
  "similar": [
    {
      "slug": "1992-june-what-does-it-take-to-run-a-successful-computer-assisted-reporting-program",
      "score": 0.366
    },
    {
      "slug": "1992-august-tech-tips-tech-tips-tech-tips-tech-tips",
      "score": 0.228
    },
    {
      "slug": "1992-october-foxpro-adds-a-new-dimension-to-sql",
      "score": 0.188
    },
    {
      "slug": "2000-julyaugust-sql-server-pays-off",
      "score": 0.178
    },
    {
      "slug": "1997-may-cheating-at-foxpro",
      "score": 0.17
    }
  ],
  "html_url": "https://dwillis.github.io/uplink/article/1992-june-tech-tips.html",
  "json_url": "https://dwillis.github.io/uplink/article/1992-june-tech-tips.json"
}