SQL: Sqlite3 common commands

# Open the database file 
sqlite3 toxrefdb_3_0.db 

-- list databases
.databases

-- list all tables
.tables

-- Lists all tables. If you provide a PATTERN, it lists tables matching that pattern. 
-- Example: .tables stu% lists tables starting with stu.
.tables PATTERN

-- Most useful command. Shows the CREATE statement for a table (or all tables if none is specified). 
-- This is the equivalent of DESCRIBE in MySQL or \d in psq
.schema TABLE

-- Shows the names of all indexes. 
-- If a table name is provided, it shows indexes for just that table.	
.indexes TABLE

-- Like .schema, but includes extra details and statistics.
.fullschema	
	
-- Turn on headers and set the output mode to box format
.headers on
.mode box

-- Get the schema for the 'studies' table
.schema studies

-- Run a query to see some data. 
SELECT * FROM studies LIMIT 3;

-- List the indexes on the 'studies' table
.indexes studies

-- Exit 
.quit

"This aggression will not stand, man."