256 Kilobytes

[Infographic] The Beginner's SQLite Cheat Sheet

Articles in Web Scraping, Data Analysis | By August R. Garcia


The important hotkeys, commands, and tricks for SQLite

814 views, 0 RAMs, and 0 comments

What a great infographic.

SQLite Cheat Sheet Infographic

Copy-Pasteable Version of the SQLite Commands Cheat Sheet

General SQLite Commands and Information

Opening SQLite

Default Open   - sqlite3
Open Database  - sqlite3 name.db

Read in SQL File

sqlite> .read file.sql

Output Formats

.mode column
.mode csv
.mode html
.mode insert
.mode line
.mode list
.mode tabs
.mode tcl

SQL Statements in SQLite

SELECT Statements


SELECT * FROM table_name;

First Ten Rows

SELECT * FROM table_name LIMIT 10;

Specify Conditions

SELECT * FROM table_name WHERE price > 100;

Match String that Starts with "D"

SELECT * FROM table_name WHERE name LIKE 'De%';

Specify Order

SELECT * FROM table_name ORDER BY name  ASC;
SELECT * FROM table_name ORDER BY name DESC;

INSERT Statements

INSERT INTO table_name (col1, col2) VALUES (20, "DOG");

UPDATE Statements

UPDATE table_name SET col1 = TRUE WHERE is_true = TRUE

DELETE Statements

DELETE from table_name WHERE is_bad <> TRUE;


=       Equal
>       Greater than
<       Less Than
>=      Greater than or equal
<=      Less than or equal
<>      Not equal
BETWEEN Specify range
LIKE    Match part of string
IN      Is in a set of values

Create Table

CREATE TABLE table_name (
  name    TEXT,
  cost    FLOAT,
  is_true BOOLEAN

Importing and Exporting in SQLite

Importing from CSV

sqlite> .mode csv
sqlite> .import file.csv table_name

Export to CSV

sqlite> .mode csv
sqlite> .output file.csv
sqlite> SELECT * FROM table;
sqlite> .output stdout

Download more RAM. 🐏 ⨉ 0Posted by August R. Garcia 1 year ago 🕓 Posted at 04 May, 2019 23:59 PM PDT

Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account