Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 761 Bytes

File metadata and controls

36 lines (26 loc) · 761 Bytes

databases sql

sqlite

sql database

  • lightweight: self-contained, single-file database that doesn't require separate server process
    • self-contained: stores entire database in a single-file on disk
    • single-file: stores the database in a single file on disk, rather than in a separate database server

basics

  • accessing a database with sqlite shell: sqlite3 my_database.db
    • if my_database.db doesn't exist, sqlite will create it automatically
  • exit sqlite shell: .quit
  • show tables: .tables
  • show schema: .schema users

import data from csv:

.mode csv
.import file.csv users

export data to a csv:

.headers on
.mode csv
.output output.csv
SELECT * FROM users;
.output stdout