Chapter 5. Window Functions, Subqueries, and Common Table Expression
This is where I start getting really excited! I love Rails, and I love Postgres. In this chapter we teach Postgres how to do new tricks by creating our own functions. We also talk about window functions, which I think are REALLY cool. Before we jump into that, let’s talk about mixing the use of raw SQL with an ORM (ActiveRecord in our case). To do this we will bounce between our two applications a little before settling in at the end of the chapter to create a visualization called the heatmap.
Why Use SQL?
This is definitely a troubling subject for some developers. Here’s the deal, though. You get to decide what code runs where. Sometimes ActiveRecord gets in the way, or can’t ...
Get Data Visualization Toolkit: Using JavaScript, Rails™, and Postgres to Present Data and Geospatial Information now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.