SlideShare una empresa de Scribd logo
1 de 13
Rajab Davudov
What is SQLite?
• SQLite is Open Source Database
  embedded into Mobile Devices.
• SQLite supports SQL syntax, transactions
  and prepared statements.
• SQLite consumes low memory approx.
  250Kbyte.
SQLite Types
• TEXT (String in Java)
• INTEGER (long in Java)
• REAL (double in Java)
SQLite in Android
• SQLite comes with all Android devices
• Application database is stored at
DATA/data/APP_NAME/databases/FILENAME
SQLite in Android
• Two packages
  – android.database
  – android.database.sqlite
SQLiteOpenHelpler
•   onCreate()
•   onUpgrade()
•   getReadableDatabase()
•   getWriteableDatabase()
SQLiteDatabase
•   insert()
•   update()
•   delete()
•   query()
•   rawQuery()
insert()
ContentValues values = new ContentValues() ;
values.put("username", username) ;
values.put("fullname", fullname) ;
values.put("password", password) ;
database.insert("users", null, values) ;
query()
Cursor cursor = database.query(
  "users",
  new String[] {"fullname"},
  "username = ? and password = ?",
  new String[]{username, password},
  null, null, null) ;
rawQuery()
Cursor cursor = database.rawQuery(
"select fullname from users where username = ?
and password = ?",
new String[] { username, password }) ;
Cursor
A Cursor represents the result of a query and
basically points to one row of the query result.
• getCount()
• moveToFirst()
• moveToNext()
• …
Think, Design, Code !!!
Rajab Davudov
  Senior Developer at Azerfon
            radjab@gmail.com
https://play.google.com/store/apps/developer?id=RADJAB
http://gplus.to/radjab
http://www.fb.me/rajab.davudov
http://www.linkedin.com/in/radjab

Más contenido relacionado

La actualidad más candente

Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
Jakir Hossain
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
Stanley Huang
 

La actualidad más candente (20)

ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
Android Database Tutorial
Android Database TutorialAndroid Database Tutorial
Android Database Tutorial
 
SQLite database in android
SQLite database in androidSQLite database in android
SQLite database in android
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
Sqlite
SqliteSqlite
Sqlite
 
Database
DatabaseDatabase
Database
 
Using sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsUsing sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add ons
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Introduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the WorldIntroduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the World
 
Sqlite
SqliteSqlite
Sqlite
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOS
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
SQLite 3
SQLite 3SQLite 3
SQLite 3
 
Android sq lite-chapter 22
Android sq lite-chapter 22Android sq lite-chapter 22
Android sq lite-chapter 22
 
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 

Destacado

Android for-indoor-services
Android for-indoor-servicesAndroid for-indoor-services
Android for-indoor-services
OSLL
 
писаревский алексей
писаревский алексейписаревский алексей
писаревский алексей
apps4allru
 

Destacado (16)

Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
 
Android development beyond the basics
Android development   beyond the basicsAndroid development   beyond the basics
Android development beyond the basics
 
Sq lite
Sq lite Sq lite
Sq lite
 
SQLite
SQLiteSQLite
SQLite
 
Android de la A a la Z - Unidad 7
Android de la A a la Z - Unidad 7Android de la A a la Z - Unidad 7
Android de la A a la Z - Unidad 7
 
SQLite3
SQLite3SQLite3
SQLite3
 
Developing for Android (The movie)
Developing for Android (The movie)Developing for Android (The movie)
Developing for Android (The movie)
 
Hackathon final
Hackathon finalHackathon final
Hackathon final
 
Brew Compilation
Brew CompilationBrew Compilation
Brew Compilation
 
Android for-indoor-services
Android for-indoor-servicesAndroid for-indoor-services
Android for-indoor-services
 
04 ns array
04   ns array04   ns array
04 ns array
 
писаревский алексей
писаревский алексейписаревский алексей
писаревский алексей
 
Дмитрий Рыжков. Intel Android x86.
Дмитрий Рыжков. Intel Android x86.Дмитрий Рыжков. Intel Android x86.
Дмитрий Рыжков. Intel Android x86.
 
Государственный реестр регистраторов расчетных операций (РРО) от 02.08.2013
Государственный реестр регистраторов расчетных операций (РРО)  от 02.08.2013Государственный реестр регистраторов расчетных операций (РРО)  от 02.08.2013
Государственный реестр регистраторов расчетных операций (РРО) от 02.08.2013
 
Use-Case is Everything
Use-Case is EverythingUse-Case is Everything
Use-Case is Everything
 
Живые обои для Android. Как создать. Тонкости. Продвижение
Живые обои для Android. Как создать. Тонкости. ПродвижениеЖивые обои для Android. Как создать. Тонкости. Продвижение
Живые обои для Android. Как создать. Тонкости. Продвижение
 

Similar a Android Database

Android App Development 05 : Saving Data
Android App Development 05 : Saving DataAndroid App Development 05 : Saving Data
Android App Development 05 : Saving Data
Anuchit Chalothorn
 

Similar a Android Database (20)

Rajab Davudov - Android Database
Rajab Davudov - Android DatabaseRajab Davudov - Android Database
Rajab Davudov - Android Database
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
Scala Frustrations
Scala FrustrationsScala Frustrations
Scala Frustrations
 
SQL Provider
SQL ProviderSQL Provider
SQL Provider
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
 
ReactJS for Beginners
ReactJS for BeginnersReactJS for Beginners
ReactJS for Beginners
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Object Relational model for SQLIite in android
Object Relational model for SQLIite  in android Object Relational model for SQLIite  in android
Object Relational model for SQLIite in android
 
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
 
An intro to Azure Data Lake
An intro to Azure Data LakeAn intro to Azure Data Lake
An intro to Azure Data Lake
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Android App Development 05 : Saving Data
Android App Development 05 : Saving DataAndroid App Development 05 : Saving Data
Android App Development 05 : Saving Data
 
Database Programming Techniques
Database Programming TechniquesDatabase Programming Techniques
Database Programming Techniques
 
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
 
[OSC 2020 Online/Nagoya] MySQLドキュメントストア
[OSC 2020 Online/Nagoya] MySQLドキュメントストア[OSC 2020 Online/Nagoya] MySQLドキュメントストア
[OSC 2020 Online/Nagoya] MySQLドキュメントストア
 
Naver_alternative_to_jpa
Naver_alternative_to_jpaNaver_alternative_to_jpa
Naver_alternative_to_jpa
 
ActiveJDBC - ActiveRecord implementation in Java
ActiveJDBC - ActiveRecord implementation in JavaActiveJDBC - ActiveRecord implementation in Java
ActiveJDBC - ActiveRecord implementation in Java
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 

Más de Rashad Aliyev

Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər
Rashad Aliyev
 
Win Phone 2 - Statistika
Win Phone 2 - StatistikaWin Phone 2 - Statistika
Win Phone 2 - Statistika
Rashad Aliyev
 
Win Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlərWin Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlər
Rashad Aliyev
 
Preparing presentations
Preparing presentationsPreparing presentations
Preparing presentations
Rashad Aliyev
 
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samplesUsing Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Rashad Aliyev
 
Apps with the operator
Apps with the operatorApps with the operator
Apps with the operator
Rashad Aliyev
 

Más de Rashad Aliyev (20)

Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər
 
Win Phone 2 - Statistika
Win Phone 2 - StatistikaWin Phone 2 - Statistika
Win Phone 2 - Statistika
 
Win Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlərWin Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlər
 
Teqdimat
TeqdimatTeqdimat
Teqdimat
 
Preparing presentations
Preparing presentationsPreparing presentations
Preparing presentations
 
HTML5 + PhoneGap & Windows Phone
HTML5 + PhoneGap & Windows PhoneHTML5 + PhoneGap & Windows Phone
HTML5 + PhoneGap & Windows Phone
 
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samplesUsing Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
 
Windows Phone8
Windows Phone8Windows Phone8
Windows Phone8
 
Apps with the operator
Apps with the operatorApps with the operator
Apps with the operator
 
Khazar University Library
Khazar University LibraryKhazar University Library
Khazar University Library
 
HTML5 + PhoneGap
HTML5 + PhoneGapHTML5 + PhoneGap
HTML5 + PhoneGap
 
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırmaDigər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
 
Telephony API
Telephony APITelephony API
Telephony API
 
Android Preferences
Android PreferencesAndroid Preferences
Android Preferences
 
Rajab Davudov - Developing Location Based Applications for Android
Rajab Davudov - Developing Location Based Applications for AndroidRajab Davudov - Developing Location Based Applications for Android
Rajab Davudov - Developing Location Based Applications for Android
 
Rajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: LayoutsRajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: Layouts
 
Ramin Orujov - Android API Overview and Repository
Ramin Orujov - Android API Overview and RepositoryRamin Orujov - Android API Overview and Repository
Ramin Orujov - Android API Overview and Repository
 
Hackathon
HackathonHackathon
Hackathon
 
Hackathon Azerbaijan Next Step
Hackathon Azerbaijan Next StepHackathon Azerbaijan Next Step
Hackathon Azerbaijan Next Step
 
Hackathon Azerbaijan
Hackathon AzerbaijanHackathon Azerbaijan
Hackathon Azerbaijan
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Android Database

  • 2. What is SQLite? • SQLite is Open Source Database embedded into Mobile Devices. • SQLite supports SQL syntax, transactions and prepared statements. • SQLite consumes low memory approx. 250Kbyte.
  • 3. SQLite Types • TEXT (String in Java) • INTEGER (long in Java) • REAL (double in Java)
  • 4. SQLite in Android • SQLite comes with all Android devices • Application database is stored at DATA/data/APP_NAME/databases/FILENAME
  • 5. SQLite in Android • Two packages – android.database – android.database.sqlite
  • 6. SQLiteOpenHelpler • onCreate() • onUpgrade() • getReadableDatabase() • getWriteableDatabase()
  • 7. SQLiteDatabase • insert() • update() • delete() • query() • rawQuery()
  • 8. insert() ContentValues values = new ContentValues() ; values.put("username", username) ; values.put("fullname", fullname) ; values.put("password", password) ; database.insert("users", null, values) ;
  • 9. query() Cursor cursor = database.query( "users", new String[] {"fullname"}, "username = ? and password = ?", new String[]{username, password}, null, null, null) ;
  • 10. rawQuery() Cursor cursor = database.rawQuery( "select fullname from users where username = ? and password = ?", new String[] { username, password }) ;
  • 11. Cursor A Cursor represents the result of a query and basically points to one row of the query result. • getCount() • moveToFirst() • moveToNext() • …
  • 13. Rajab Davudov Senior Developer at Azerfon radjab@gmail.com https://play.google.com/store/apps/developer?id=RADJAB http://gplus.to/radjab http://www.fb.me/rajab.davudov http://www.linkedin.com/in/radjab