O'Reilly logo

Clojure Web Development Essentials by Ryan Baldwin

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

Fetching albums from the database

In Chapter 7, Getting Started with the Database, we were introduced to YeSQL for interacting with our database. We used YeSQL to create an INSERT statement which added our new users to the database. Similarly, we can use YeSQL to SELECT records from the database. If you can do it in SQL, you can do it with YeSQL. And that's the beauty of YeSQL: it's just SQL. This allows us to open an SQL tool of our choice and experiment with our query until we get it right.

Writing the SQL query

For this next bit, we'll use the psql tool to verify our SQL. But you're free to use whatever SQL editor you have at your disposal. Take the following steps:

  1. Launch psql and connect to our database:
    # psql -U hipstr -d postgres -h localhost ...

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