0% found this document useful (0 votes)
20 views2 pages

Sqlite Syntax Reference

This document serves as a quick reference guide for SQLite syntax, covering data types, basic commands, joins, common functions, and transactions. It outlines key commands such as CREATE TABLE, INSERT, SELECT, UPDATE, and DELETE, along with examples of their usage. Additionally, it includes common functions for string manipulation and date handling, as well as a brief overview of transaction management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Sqlite Syntax Reference

This document serves as a quick reference guide for SQLite syntax, covering data types, basic commands, joins, common functions, and transactions. It outlines key commands such as CREATE TABLE, INSERT, SELECT, UPDATE, and DELETE, along with examples of their usage. Additionally, it includes common functions for string manipulation and date handling, as well as a brief overview of transaction management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQLite Syntax Quick Reference

SQLite is a lightweight, serverless, self-contained SQL database engine. While its syntax is similar
to standard SQL, there are some differences. This guide covers basic to advanced SQLite syntax
for quick reference.

Data Types in SQLite


Type Description
NULL Represents a missing value.
INTEGER Signed integer (1, 2, 3, 4, 6, or 8 bytes).
REAL Floating-point value (8-byte IEEE).
TEXT Text string, stored using database encoding (UTF-8, UTF-16).
BLOB Binary data stored exactly as input.

Basic Commands
CREATE TABLE
CREATE TABLE table_name (
column1 datatype PRIMARY KEY,
column2 datatype NOT NULL,
column3 datatype DEFAULT value
);

INSERT
INSERT INTO table_name (column1, column2)
VALUES (value1, value2);

SELECT
SELECT column1, column2 FROM table_name
WHERE condition;

UPDATE
UPDATE table_name
SET column1 = value1
WHERE condition;

DELETE
DELETE FROM table_name WHERE condition;

Joins in SQLite
SELECT table1.column1, table2.column2
FROM table1
INNER JOIN table2 ON table1.id = table2.id;

Common SQLite Functions


Function Example Description
Length SELECT LENGTH('Hello'); Returns the length of a string.
Upper SELECT UPPER('hello'); Converts text to uppercase.
Lower SELECT LOWER('HELLO'); Converts text to lowercase.
Date SELECT DATE('now'); Returns the current date.
Datetime SELECT DATETIME('now'); Returns the current date and time.

Transactions
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

You might also like