SQLite Database
SQLite is an open-source relational database i.e. used to
perform database operations on android devices such as storing,
manipulating or retrieving persistent data from the database.
It is embedded in android by default. So, there is no need to
perform any database setup or administration task.
Is SQLite better than MySQL?
Both the SQLite and MYSQL have certain advantages.
SQLite is file-based — the database consists of a single file on
the disk, which makes it extremely portable and reliable. ..
MySQL is secured, which makes it highly advanced, too. It can
even handle a good amount of data and hence can be used at-
scale
Structured Query Language (SQL) Data is accessed in SQLite
databases using a high level language known as Structured
Query Language.
SQLite is at the heart of Android‘s database support.
• Simple, small (~350KB), light weight RDMS implementation with simple
API
• Each database is stored as a single file containing both Pragma & Data
• Writes cause file locking and are always sequential and blocking
• Reads can be multi-tasked
• SQLite is so dominant in the embedded and also the mobile world due to,
• Low memory consumption
• Ease of use
• Free availability
• Open Source
• ACID Compliant
• Uses SQL query language
It differs in many aspects from a conventional database
system.
• SQLite is serverless
• SQLite stores data in one database file
• SQLite offers only a few data types
• SQLite uses manifest typing instead of static types
• SQLite has no fixed column length
• SQLite uses cross-platform database files
Data Types in SQLite
• NULL – The null value
• INTEGER - Any number which is no floating point number
• REAL - A floating point value, 8-byte IEEE floating point
number.
• TEXT - text string and also single characters, stored using
the database encoding (UTF-8, UTF-16BE or UTF-16LE).
• BLOB - The value is a blob of data, stored exactly as it was
input. (binary large object)
SQLite Classes
• SQLiteCursor - A Cursor implementation that exposes results
from a query on a SQLiteDatabase.
• SQLiteDatabase - Exposes methods to manage a SQLite
database. It has methods to create, delete, execute SQL
commands, and perform other common database management
tasks.
• SQLiteOpenHelper - A helper class to manage database
creation and version management.
• SQLiteProgram - A base class for compiled SQLite
programs.
• SQLiteQuery – A SQLite program that represents a query
that reads the resulting rows into a CursorWindow.
• SQLiteQueryBuilder - A convenience class that helps build
SQL queries to be sent to SQLiteDatabase objects.
• SQLiteStatement - A pre-compiled statement against a
SQLiteDatabase that can be reused.