SQLite3 cheatsheet


  • open database sqlite3 file.db
  • show tables .tables
  • quit .quit
  • select: select * from book;
  • columns PRAGMA table_info(book);
  • create sytnax: .schema book;
  • show column headers: .headers ON

  • open a database

    sqlite3 my_stuff_database.db
  • print database structure

  • print database structure and data

  • turn on / off column names in results

    .explain on
    .explain off
  • show databases

  • show tables

  • show current settings

  • show headings

    .header on
  • show columns

    .mode column
  • show timer (how long query took)

    .mode timer
  • quit

  • show index

    .indices [table]
  • rename a table

     alter table department rename to dept;