Skip to main content

Database

Database guides: PostgreSQL, Valkey, Azure SQL Database, Azure Cosmos DB and local SQL databases, from first concepts to queries, table design, caching and connecting your apps.

Latest posts

0 comments 0 reactions

What Is SQL?

Jagdish Kumawat

SQL is the language you use to work with data in a relational database. See what a statement looks like, then run the five you will use most on a small table of pets.

0 comments 0 reactions

How to Customize psql with .psqlrc

Jagdish Kumawat

Put your favourite psql settings in a .psqlrc file, and every session starts with timing, expanded display and a clearer prompt already on.

0 comments 0 reactions

How to Run a SQL File in psql

Jagdish Kumawat

Save your SQL in a file and run every statement at once: \i inside psql, or psql -f from Terminal, with errors that name the file and line.

0 comments 0 reactions

How to Use Expanded Display in psql

Jagdish Kumawat

Make wide PostgreSQL results readable in psql: \x shows each row as a list of columns, \x auto picks for you, and \gx expands a single query.

0 comments 0 reactions

How to Time Queries in psql

Jagdish Kumawat

Turn on psql's timer with \timing to see how long each PostgreSQL query takes, and turn it off again when you're done.

0 comments 0 reactions

How to Switch Databases in psql

Jagdish Kumawat

Move between PostgreSQL databases in psql with \c, check which one you're in, and start psql straight in the database you want with -d.

0 comments 0 reactions

How to List Databases in PostgreSQL

Jagdish Kumawat

List every database on your PostgreSQL server with \l in psql, see their sizes with \l+, or get just the names with a pg_database query.

0 comments 0 reactions

How to Get Help in psql

Jagdish Kumawat

psql has help built in: help gives a summary, \? lists psql's own commands, and \h shows the syntax of any SQL command.