Introductory part aboutSQLITE
SQLite is a self-contained, server less, and zero-configuration relational
database management system (RDBMS).
It is designed to be embedded into applications, providing a lightweight
and efficient way to store and manage data.
SQLite is a popular choice for many applications, including mobile apps,
desktop applications, embedded systems, and web applications
3.
Key Features ofSQLITE
Server less
Zero-configuration
Relational database: SQLite supports standard relational database
features, including:
- Tables
- Indexes
- Views
- Transactions
4.
Key Features ofSQLITE
ACID compliance: SQLite follows the Atomicity, Consistency, Isolation, and
Durability (ACID) principles, ensuring that database transactions are
processed reliably
Atomicity
Consistency
Isolation
Durability
Creating and openingDatabase
Creating and Opening a Database
The SQLiteOpenHelper class helps in database management.
onCreate() → Called when the database is created for the first time.
7.
Creating Tables
• Atable in SQLite consists of columns (fields) with specific data types.
Common Data Types in SQLite: INTEGER → Stores whole numbers.
• TEXT → Stores text values.
• REAL → Stores floating-point numbers.
• BLOB → Stores binary data.
8.
Creating tables code
publicvoid onCreate(SQLiteDatabase db) {
String CREATE_TABLE = "CREATE TABLE students (id INTEGER PRIMARY KEY,
name TEXT, age INTEGER)";
db.execSQL(CREATE_TABLE);
}