Company
Date Published
Author
Keshav Murthy
Word count
1042
Language
English
Hacker News points
None

Summary

The text discusses using Couchbase and SQL to analyze a public dataset on leading causes of death in the United States. The dataset is downloaded into a local file, uploaded to a Couchbase cluster, and then imported into a bucket called "cause". A common table expression (CTE) is used to transform the complex JSON data into flat JSON. Two queries are provided to find the top cause of death for each state by year and to determine how the top reason has changed over time by state. The first query groups the data by state, year, and cause name, while the second query groups the data by state, year, and cause name, and uses window functions to rank the causes. The results are then visualized using a histogram.