O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Esqueleto to do advanced SQL queries

We have used the Persistent library and SQL expressions using the Database.Persist.SQL module. We have used the generated types for each field in the filter, insert, and update expressions. But the complexity of the query can increase rapidly. Of course, there is a way to do a plain SQL query with the persistent library. Here, in this recipe, we will be using the Esqueleto library to do complex queries such as joins.

In this recipe, we will write a complex SQL query that is type-safe and easy to write. Being type-safe is good, because we will catch any major issues earlier on!

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required