Blog

Sql

4 posts tagged sql — the same founder-tested patterns, filtered.

Linking Data in PostgreSQL Without Explicit Keys: A Practical Guide

Linking Data in PostgreSQL Without Explicit Keys: A Practical Guide

Databases often evolve in unpredictable ways. Tables that were initially designed to operate independently might later need to be connected.
SQL: Get records having min/max value per group

SQL: Get records having min/max value per group

The solution doesn't require any changes to the DB scheme (denormalization or creation of views) and can be performed in the scope of a single SQL query.
How to avoid N+1 query using SQL views (materialized) in Rails application

How to avoid N+1 query using SQL views (materialized) in Rails application

In the first part, we considered the solution with extracting logic to the separate class and implementing the Facade pattern.
Custom ordering without custom SQL with Ruby on Rails 7

Custom ordering without custom SQL with Ruby on Rails 7

Ordering records by an enum in Rails 7 without hand-written SQL: in_order_of puts the rows in the sequence you name.

Reading this because something is going wrong?

A free code audit gives you a written assessment of your codebase in plain English.

Get a Free Code Audit

Rated 4.8/5 on Clutch · you keep the write-up either way