What Is SQL?
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.
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.
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.
Put your favourite psql settings in a .psqlrc file, and every session starts with timing, expanded display and a clearer prompt already on.
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.
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.
Turn on psql's timer with \timing to see how long each PostgreSQL query takes, and turn it off again when you're done.
Connect psql to a PostgreSQL database in one go with a connection URI, and learn what each part of postgresql://user@host:port/dbname means.
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.
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.
psql has help built in: help gives a summary, \? lists psql's own commands, and \h shows the syntax of any SQL command.