SlideShare a Scribd company logo
Android SQLite
Created By S. Ali Jafar
History of SQLite
• SQlite is an open source embedded database. The original
implementation was designed by D. Richard Hipp.
• Hipp was designing software used on board guided
missile systems and thus had limited resources to work
with.
• The resulting design goals of SQLite were to allow the
program to be operated without a database installation
or administration.
Why Sqlite Only????
• In android we will use Sqlite database only . Because it is
in built DB in Android SDK more over it is lite weighted
relation DB suitable for Mobile Devices.
• We need not to load any drivers and we need not to
install the Sqlite separately .
• The queries also simple to understand and easy to
implement.
Feature of SQLite
• Application file format – Transactions guarantee ACID
[Atomicity, Consistency , Isolation, Durability] even after
system crashes and power failures.
• Temporary data analysis – Command line client, import
CSV files and use sql to analyze & generate reports .
• Embedded devices – Applicable to small, reliable and
portable like mobiles.
• Portable - uses only ANSI-standard C and VFS, file format
is cross platform (little vs. big endian, 32 vs. 64 bit)
Feature of SQLite
• Reliable – has 100% test coverage, open source code and
bug database, transactions are ACID even if power fails.
• Small – 300 kb library, runs in 16kb stack and 100kb heap.
• Single Database File – An SQLite database is a single
ordinary disk file that can be located anywhere in the
directory hierarchy .
• Readable source code – The source code to SQLite is
designed to be readable and accessible to the average
programmer .
Disadvantages
High concurrency – reader/writer locks on the entire file.
Huge datasets – DB file can’t exceed file system limit or 2TB.
Access control – we don’t have any user interface to operate
Sqlite database objects as in MYSQL / SQL Server/Oracle. All the
objects are virtual. However there are few third party UI are
available in the market.
SQLite Classes
• SQLiteCloseable - An object created from a SQLiteDatabase
that can be closed.
• SQLiteCursor - A Cursor implementation that exposes results
from a query on a SQLiteDatabase.
• SQLiteDatabase - Exposes methods to manage a SQLite
database.
• 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.
SQLite OpenHelper Class
• SQLite OpenHelper is a class to manage database creation
and version management.
• This class take care of opening the database if it exists,
creating it if it does not, and upgrading it as necessary.
• This is for creating db “ onCreate(SQLiteDataBase)”.
• When the database needs to be upgraded
“ onUpgrade (SQLiteDataBase db, int oldVersion, int
newVersion)”.
• When the database has been opened “onOpen
(SQLiteDataBase db)”.
SQLite Architecture
SQLite Architecture
SQLite Architecture
SQLite Architecture
Sql data base
Steps in working with Sqlite database:
Creating Sqlite Object
Creating Database
Creating Table
Working with Tab
Step:1 Importing package
“android.database.sqlite.SQLiteDatabase”.
Step:2 Creating object
SQLiteDatabase object name= ;
Example To Do:
• mydb=openOrCreateDatabase("DatabaseName5",
MODE_PRIVATE,null);
• Example
• //mydb is sqlite object name .
• //DatabaseName5 is nothing but database name
• //MODE_PRIVATE is permissions of a table accessing
Example To Do:
mydb.execSQL("CREATE TABLE IF NOT EXISTS “
+TableName+" (ColumnName DataType);")
Example To Do:
Create:
• mydb.execSQL("CREATE TABLE IF NOT EXISTS “
• +TableName+" (ColumnName DataType);");
Alter:
• ALTER TABLE TableName RENAME TO new-table-name
Drop:
• DROP TABLE TableName
• (View Source)
Example To Do:
Select:
• Cursor c=mydb.rawQuery("SELECT * FROM "+TableName+"
• where Name='"+city+"'",null);
Insert:
• mydb.execSQL("INSERT INTO "+TableName+“ (Name, Area)“ +
• "VALUES ('RedFort','40.8 acres‘);");
Delete:
• mydb.execSQL(“Delete"+TableName);

More Related Content

PDF
Getting Started with SQLite
PPTX
SQLite - Overview
PPTX
A brief introduction to SQLite PPT
PPTX
Sq lite presentation
PPTX
MySQL enterprise edition
PPT
SQL Azure Intro and what’s New
PPT
Sqlite
PPTX
Case study on mysql in rdbms
Getting Started with SQLite
SQLite - Overview
A brief introduction to SQLite PPT
Sq lite presentation
MySQL enterprise edition
SQL Azure Intro and what’s New
Sqlite
Case study on mysql in rdbms

What's hot (20)

PPTX
Advanced SQL Server Performance Tuning | IDERA
PDF
MySQL overview
PDF
Confoo 202 - MySQL Group Replication and ReplicaSet
PPTX
Adi Sapir ISUG 123 11/10/2012
PPTX
SQL Server & SQL Azure Temporal Tables - V2
PPTX
SQLite: Light, Open Source Relational Database Management System
PPTX
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
PDF
01 upgrade to my sql8
PDF
SQL Server 2019 Data Virtualization
PPTX
SSIS Monitoring Deep Dive
PDF
Build 2014 - Running Java and Oracle Applications on Microsoft Azure
PPTX
Advantage & Disadvantage of MySQL
PPT
Php connectivitywithmysql
ODP
Introduction4 SQLite
PPTX
Li liq liqui liquibase
PPTX
Geek Sync | SQL Security Principals and Permissions 101
PPTX
Market Trends in Microsoft Azure
PDF
Windows azure sql_database_security_isug012013
PPT
Liquibase – a time machine for your data
PDF
Using extended events for troubleshooting sql server
Advanced SQL Server Performance Tuning | IDERA
MySQL overview
Confoo 202 - MySQL Group Replication and ReplicaSet
Adi Sapir ISUG 123 11/10/2012
SQL Server & SQL Azure Temporal Tables - V2
SQLite: Light, Open Source Relational Database Management System
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
01 upgrade to my sql8
SQL Server 2019 Data Virtualization
SSIS Monitoring Deep Dive
Build 2014 - Running Java and Oracle Applications on Microsoft Azure
Advantage & Disadvantage of MySQL
Php connectivitywithmysql
Introduction4 SQLite
Li liq liqui liquibase
Geek Sync | SQL Security Principals and Permissions 101
Market Trends in Microsoft Azure
Windows azure sql_database_security_isug012013
Liquibase – a time machine for your data
Using extended events for troubleshooting sql server
Ad

Similar to Sql data base (20)

PPT
Sq lite database
PPTX
android sqlite
PPTX
Data Handning with Sqlite for Android
PDF
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
PPTX
SQLite in Flutter.pptx
PPTX
ScaleBase Webinar: Scaling MySQL - Sharding Made Easy!
PPTX
Azure data lake sql konf 2016
PDF
20090425mysqlslides 12593434194072-phpapp02
PPTX
SQL in Version Control using SQL Server Database Projects
PDF
MySQL 8: Ready for Prime Time
PPTX
Scalable relational database with SQL Azure
PDF
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
PDF
Database as a Service on the Oracle Database Appliance Platform
PDF
My sql crashcourse_intro_kdl
PPTX
Sq lite
PPTX
Geek Sync | Deployment and Management of Complex Azure Environments
PPT
PPTX
Study of SQLite
PPTX
Contains the SQLite database management classes that an application would use...
PPTX
Azure Synapse Analytics Overview (r2)
Sq lite database
android sqlite
Data Handning with Sqlite for Android
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
SQLite in Flutter.pptx
ScaleBase Webinar: Scaling MySQL - Sharding Made Easy!
Azure data lake sql konf 2016
20090425mysqlslides 12593434194072-phpapp02
SQL in Version Control using SQL Server Database Projects
MySQL 8: Ready for Prime Time
Scalable relational database with SQL Azure
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
Database as a Service on the Oracle Database Appliance Platform
My sql crashcourse_intro_kdl
Sq lite
Geek Sync | Deployment and Management of Complex Azure Environments
Study of SQLite
Contains the SQLite database management classes that an application would use...
Azure Synapse Analytics Overview (r2)
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Introduction to Artificial Intelligence
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
System and Network Administration Chapter 2
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Essential Infomation Tech presentation.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
top salesforce developer skills in 2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PTS Company Brochure 2025 (1).pdf.......
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Softaken Excel to vCard Converter Software.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Introduction to Artificial Intelligence
Odoo Companies in India – Driving Business Transformation.pdf
Nekopoi APK 2025 free lastest update
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
System and Network Administration Chapter 2
How to Choose the Right IT Partner for Your Business in Malaysia
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Understanding Forklifts - TECH EHS Solution
Essential Infomation Tech presentation.pptx
Design an Analysis of Algorithms II-SECS-1021-03
top salesforce developer skills in 2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf

Sql data base

  • 2. History of SQLite • SQlite is an open source embedded database. The original implementation was designed by D. Richard Hipp. • Hipp was designing software used on board guided missile systems and thus had limited resources to work with. • The resulting design goals of SQLite were to allow the program to be operated without a database installation or administration.
  • 3. Why Sqlite Only???? • In android we will use Sqlite database only . Because it is in built DB in Android SDK more over it is lite weighted relation DB suitable for Mobile Devices. • We need not to load any drivers and we need not to install the Sqlite separately . • The queries also simple to understand and easy to implement.
  • 4. Feature of SQLite • Application file format – Transactions guarantee ACID [Atomicity, Consistency , Isolation, Durability] even after system crashes and power failures. • Temporary data analysis – Command line client, import CSV files and use sql to analyze & generate reports . • Embedded devices – Applicable to small, reliable and portable like mobiles. • Portable - uses only ANSI-standard C and VFS, file format is cross platform (little vs. big endian, 32 vs. 64 bit)
  • 5. Feature of SQLite • Reliable – has 100% test coverage, open source code and bug database, transactions are ACID even if power fails. • Small – 300 kb library, runs in 16kb stack and 100kb heap. • Single Database File – An SQLite database is a single ordinary disk file that can be located anywhere in the directory hierarchy . • Readable source code – The source code to SQLite is designed to be readable and accessible to the average programmer .
  • 6. Disadvantages High concurrency – reader/writer locks on the entire file. Huge datasets – DB file can’t exceed file system limit or 2TB. Access control – we don’t have any user interface to operate Sqlite database objects as in MYSQL / SQL Server/Oracle. All the objects are virtual. However there are few third party UI are available in the market.
  • 7. SQLite Classes • SQLiteCloseable - An object created from a SQLiteDatabase that can be closed. • SQLiteCursor - A Cursor implementation that exposes results from a query on a SQLiteDatabase. • SQLiteDatabase - Exposes methods to manage a SQLite database. • 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.
  • 8. SQLite OpenHelper Class • SQLite OpenHelper is a class to manage database creation and version management. • This class take care of opening the database if it exists, creating it if it does not, and upgrading it as necessary. • This is for creating db “ onCreate(SQLiteDataBase)”. • When the database needs to be upgraded “ onUpgrade (SQLiteDataBase db, int oldVersion, int newVersion)”. • When the database has been opened “onOpen (SQLiteDataBase db)”.
  • 14. Steps in working with Sqlite database: Creating Sqlite Object Creating Database Creating Table Working with Tab
  • 16. Example To Do: • mydb=openOrCreateDatabase("DatabaseName5", MODE_PRIVATE,null); • Example • //mydb is sqlite object name . • //DatabaseName5 is nothing but database name • //MODE_PRIVATE is permissions of a table accessing
  • 17. Example To Do: mydb.execSQL("CREATE TABLE IF NOT EXISTS “ +TableName+" (ColumnName DataType);")
  • 18. Example To Do: Create: • mydb.execSQL("CREATE TABLE IF NOT EXISTS “ • +TableName+" (ColumnName DataType);"); Alter: • ALTER TABLE TableName RENAME TO new-table-name Drop: • DROP TABLE TableName • (View Source)
  • 19. Example To Do: Select: • Cursor c=mydb.rawQuery("SELECT * FROM "+TableName+" • where Name='"+city+"'",null); Insert: • mydb.execSQL("INSERT INTO "+TableName+“ (Name, Area)“ + • "VALUES ('RedFort','40.8 acres‘);"); Delete: • mydb.execSQL(“Delete"+TableName);