Skip to content

Instantly share code, notes, and snippets.

@aceakash
Last active April 13, 2018 12:37
Show Gist options
  • Save aceakash/676683411984a2f2574582521631eee1 to your computer and use it in GitHub Desktop.
Save aceakash/676683411984a2f2574582521631eee1 to your computer and use it in GitHub Desktop.
SQLite3 Cheat Sheet

Open SQLite3 shell with headers and column mode on:

sqlite3 -column -header your_db.db

Meta Commands

Meta Command Description
.show Displays current settings for various parameters
.databases Provides database names and files
.tables Show current tables
.quit Quit
.schema Show schemas of tables
.headers Set headers on or off
.mode Select mode for the output table

Data Types

Create Table

CREATE TABLE comments ( 
	post_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
	name TEXT NOT NULL, 
	email TEXT NOT NULL, 
	website_url TEXT NULL, 
	comment TEXT NOT NULL );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment