-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLite_CheatSheet.txt
70 lines (62 loc) · 1.16 KB
/
SQLite_CheatSheet.txt
1
SQLite “cheat sheet”**********************1. Tips! a. SQL is not case sensitive b. End each SQL statement with a “;” c. Use “*” to select a record d. White space doesn’t matter e. Select statement is like creating a new table f. Field value needs to be in quotes g. Use parentheses to force order of operations h. “--” to comment 2. Creating databases a. CREATE DATABASE db_name3. Creating tables a. CREATE TABLE table_name (field DATA TYPE CONSTRAINT) i. Data types 1. DATE 2. TIME 3. TIMESTAMP 4. VARCHAR/CHARACTER 5. BOOLEAN 6. INTEGER 7. DOUBLE PRECISION (FLOAT) 8. XML ii. Constraints 1. PRIMARY KEY 2. FOREIGN KEY 3. UNIQUE 4. DEFAULT 5. AUTOINCREMENT 6. NOT NULL4. Querying the database a. SELECT/FROM b. INSERT INTO (VALUES) c. INNER JOIN d. WHERE (like a filter) e. ORDER BY ASC/DESC f. AS (alias for field name) g. IN h. AND i. BETWEEN j. LIKE (%..%) k. OR l. CONCAT m. LENGTH n. DISTINCT o. UPDATE/SET p. DELETE q. LIMIT r. BETWEEN s. IS (NOT) NULL5. Functions a. AVG() b. COUNT() c. MAX() d. MIN() e. SUM() f. UCASE() g. LCASE() h. FIRST() i. LAST() j. GROUP BY