Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 2.37 KB

File metadata and controls

64 lines (45 loc) · 2.37 KB

SQLite Tutorial - An Easy Way to Master SQLite Fast

Pragma statements supported by SQLite

Columns/keys SQLite Primary Key: The Ultimate Guide To Primary Key (sqlitetutorial.net)

How do I rename a column in a SQLite database table? - Stack Overflow sql - SQLite issue with Table Names using numbers? - Stack Overflow

DML sql - Cross-table UPDATE in SQLITE3 - Stack Overflow

Index The SQLite Query Optimizer Overview SQLite Primary Key: The Ultimate Guide To Primary Key (sqlitetutorial.net)

CLI Command Line Shell For SQLite

Query plan EXPLAIN QUERY PLAN (sqlite.org)

.database  
.tables  
  
--Attach another database
ATTACH DATABASE file_name AS database_name;
--copy whole table as new  
CREATE TABLE NewTable AS SELECT * FROM OldTable WHERE 0;  
--copy just data structure  
create table NewTable as select * from OldTable where 1 <> 1

-- Capitalize First letter  
SELECT Czech, UPPER(SUBSTR(Czech,1,1)) || LOWER(SUBSTR(Czech,2,LENGTH(Czech))) AS Rest FROM seznam   
--update query - capitalize  
UPDATE seznam SET Czech=UPPER(LEFT(Czech,1))+LOWER(SUBSTRING(Czech,2,LEN(Czech)))  
UPDATE seznam SET Czech=UPPER(SUBSTR(Czech,1,1)) || LOWER(SUBSTR(Czech,2,LENGTH(Czech)))  
  
--replace part of string  
UPDATE table SET field = replace( field, 'find_string', 'replace_string' )

-- Conditionals
CASE WHEN key='value1' THEN 'something' WHEN key='value2' THEN 'somethingelse'
--Single quote
cast(X'27' as text)
--Double quote
cast(X'22' as text)

Backup/Restore

sql - How do I dump the data of some SQLite3 tables? - Stack Overflow

sqlite3.exe .\file.db ".dump" > DDL.sql

Security

SQLite3 Injection Cheat Sheet - ~/haxing (cked.me)