Skip to content

usql

One command line for PostgreSQL, MySQL, SQLite, SQL Server, Oracle, DuckDB and many other databases. It works like psql.
A first session: open a SQLite file, list its tables, run a query, and draw a chart.

Download the files of the example: books.db, books.sql.

usql opens a database from a URL, such as pg://user@host/db or my://localhost/db, or from a file on disk. The prompt takes SQL and psql’s backslash commands, such as \d, \copy, \set and \pset. It also has commands that psql does not have: \copy between two databases, \dump, and \chart, which draws a chart in the terminal.

  1. Install usql.
  2. Take the first steps.
  3. If you know psql, read Coming from psql.
  4. Read a guide, such as Connect to a database or Copy data between databases, or a recipe, such as Export a query to CSV.
  5. Look up an option, a meta command or a setting.