SQL Notes
Learn how to install SQLite, understand its architecture, create databases, run SQL queries, and start building lightweight applications with SQLite.
Most databases—MySQL, PostgreSQL, SQL Server—run a server in the background that handles requests. SQLite is different.
SQLite is lightweight. There's no server. Your entire database is just a file on your computer.
Because of that simplicity, it's everywhere:
- Android applications
- iOS applications
- Desktop software
- Embedded systems
- IoT devices
- Browser applications
- Small web projects
This guide shows you what SQLite is, why developers use it, how to install it, and how to create your first database.
Why Learn SQLite?
SQLite seems simple, but don't underestimate it. Billions of devices run it.
Simple Setup
No server installation. You're up and running in minutes.
Lightweight
Barely uses any memory or storage. Perfect for:
- Mobile apps
- Embedded systems
- Offline applications
Portable
Moving your database is as easy as copying a file:
school.dbCopy the file, and the entire database moves with it.
Industry Usage
It's used by:
- Android
- iPhone Applications
- Firefox
- Chrome
- Embedded Devices
- Smart TVs
Learning SQLite teaches you relational databases without dealing with server administration headaches.
How SQLite Works
Most databases follow this pattern:
Application
↓
Database Server
↓
DatabaseSQLite works like this:
Application
↓
SQLite Library
↓
Database FileNo separate server. Your application directly accesses the database file. This makes SQLite super fast for local applications.
Advantages of SQLite
SQLite brings several benefits:
Zero Configuration
No server setup needed.
Fast Performance
Excellent for local applications.
Small Size
The entire SQLite engine is tiny compared to traditional databases.
Portable Databases
Databases are single files.
Open Source
Completely free.
Limitations of SQLite
SQLite isn't right for everything.
Limited Concurrent Writes
Multiple users can't write data simultaneously like they can with server-based databases.
Not Ideal for Large Enterprise Systems
Large banking or social media platforms need more advanced setups.
Simplified User Management
SQLite doesn't offer the sophisticated user account management of PostgreSQL or MySQL.
Despite these limitations, SQLite remains one of the most deployed database systems ever.
Installing SQLite on Windows
Unlike MySQL or PostgreSQL, SQLite has no big installer. You just download the tools.
Step 1: Download SQLite
Grab the SQLite command-line tools for Windows.
You get:
sqlite3.exeThis executable lets you create and manage SQLite databases.
Step 2: Extract Files
Unzip the downloaded archive.
Example:
C:\SQLiteInside you'll find:
sqlite3.exeStep 3: Add SQLite to PATH
Adding SQLite to your PATH lets you run it from any terminal window.
After setup, you can run:
sqlite3from anywhere.
Step 4: Verify Installation
Open Command Prompt:
sqlite3 --versionYou should see:
3.50.xGood. It's installed.
Installing SQLite on Ubuntu Linux
Most Linux distributions have SQLite in their package manager.
Update your packages:
sudo apt updateInstall SQLite:
sudo apt install sqlite3Verify:
sqlite3 --versionYou'll see the version.
Installing SQLite on macOS
Many macOS systems already have SQLite.
Check:
sqlite3 --versionMissing? Use Homebrew:
brew install sqliteCheck again:
sqlite3 --versionStarting SQLite
Open SQLite from the terminal:
sqlite3You'll see:
SQLite version 3.x.x
sqlite>That prompt means you're ready to start entering commands.
Creating Your First Database
Unlike MySQL and PostgreSQL, SQLite databases are just files.
Create one:
sqlite3 school.dbSQLite automatically creates:
school.dbif it doesn't exist.
Viewing Databases
SQLite uses files as databases.
Example:
school.db
company.db
library.dbEach file is a complete database.
Creating Your First Table
Inside SQLite:
CREATE TABLE Students (
StudentID INTEGER PRIMARY KEY,
Name TEXT,
Age INTEGER
);Your table is stored inside the database file.
View Existing Tables
List all tables:
.tablesOutput:
Students
Your table exists.
Insert Data
Add student records:
INSERT INTO Students
VALUES
(1, 'Rahul', 20);
INSERT INTO Students
VALUES
(2, 'Priya', 21);SQLite saves the data right away.
Retrieve Data
Run:
SELECT * FROM Students;Output:
| StudentID | Name | Age |
|---|---|---|
| 1 | Rahul | 20 |
| 2 | Priya | 21 |
Boom. You've written and executed your first SQLite query.
Useful SQLite Commands
Show Tables
.tablesLists all your tables.
View Table Structure
.schema StudentsShows how the table is defined.
Exit SQLite
.quitCloses your session.
Display All Database Objects
.schemaShows everything in the database.
Real-World Applications of SQLite
SQLite is seriously used in production.
Mobile Applications
Most Android apps use SQLite for local storage.
Web Browsers
Several browsers rely on SQLite internally.
Embedded Devices
Smart devices often use SQLite because it's tiny.
Desktop Applications
Many desktop apps store config and user data using SQLite.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Install SQLite.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this SQL Complete Guide topic.
Search Terms
sql-complete-guide, sql complete guide, sql, complete, guide, setup, install, sqlite
Related SQL Complete Guide Topics