DataBase

Vengatesh. s
<Vengatesh .  süïzilogic .  com>

ihelpfi contents?  Copyright © VengneIhJ slide 1/ 12
What is DataBase? 

Collection Data or Information
Contains tables,  queries,  reports and views

Easy to access,  manage ...
DBMS (DataBase Management System)

I System software to create and manage databases. 

I Serves as an interface between th...
DBMS (Cont. ..)

I Network

fitfiu

I Relational

 

I Object-oriented

0008 Clau Infinitum! 

 

Ïhelpfi contents?  Copyright...
SQLite

SQL stands for Structured Query Language. 
A Relational DataBase Management System. 
Used to sore user-defined reco...
Why we need SQLite? 

I Serverless

I Zero Configuration
I Cross-Platform

I Self- Contained

I Transaction

I Highly Relia...
SQLite Queries

SQLite Data Definition Language Queries: 

I Create

CREATE TABLE table_name(
columnl datatype, 
column2 da...
SQLite Queries (Cont. ..)

SQLite Data Manipulation Language Queries: 

I Insert

INSERT INTO table_name (columnl,  column...
Android SQLite

Built-in SQLite database
Main packages of SQLite android. database. sqlite
Provides Helper class to manage...
DataBase Helper

I Manages all operations related to database. 

I Automatically manages creation and update of the databa...
Cursor

Retrieves data from database

SQLite query method returns a Cursor object. 

Example : 

Cursor Cursor =  db. quer...
Thank You

ihelpi’;  contents?  Copyright © Vengatesh. s rlide 12/ 12
Próxima SlideShare
Cargando en…5
×

Android SQLite

192 visualizaciones

Publicado el

Publicado en: Motor
0 comentarios
0 recomendaciones
Estadísticas
Notas
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Sin descargas
Visualizaciones
Visualizaciones totales
192
En SlideShare
0
De insertados
0
Número de insertados
7
Acciones
Compartido
0
Descargas
4
Comentarios
0
Recomendaciones
0
Insertados 0
No insertados

No hay notas en la diapositiva.

Android SQLite

  1. 1. DataBase Vengatesh. s <Vengatesh . süïzilogic . com> ihelpfi contents? Copyright © VengneIhJ slide 1/ 12
  2. 2. What is DataBase? Collection Data or Information Contains tables, queries, reports and views Easy to access, manage and update. contents? Copyright © Vengatesh. s slide 2/12
  3. 3. DBMS (DataBase Management System) I System software to create and manage databases. I Serves as an interface between the database and end users. I MySQL, Oracle, IBM DB2, Microsoft SQL Server etc. I Various types of DBMS such as: o Hierarchial ïhelpïií contents? Copyright © Vengatesh. s slide 3/12
  4. 4. DBMS (Cont. ..) I Network fitfiu I Relational I Object-oriented 0008 Clau Infinitum! Ïhelpfi contents? Copyright © Vengatesh. s slide 4/12
  5. 5. SQLite SQL stands for Structured Query Language. A Relational DataBase Management System. Used to sore user-defined records in a larger tables. Classified into three different groups: DDL (Data Definition Language) Used to create and modify the structure of database. Performs operations like create, alter, drop, tI'uncate. DML (Data Manipulation Language) Used to insert, update, delete data from database. DQL (Data Query Language) Used to retrieves data from tables. ïhelp? : contents? Copyright © Vengatesh. s slide 5/12
  6. 6. Why we need SQLite? I Serverless I Zero Configuration I Cross-Platform I Self- Contained I Transaction I Highly Reliable ïhelp? í contents? Copyright © Vengatesh. s slide 6/12
  7. 7. SQLite Queries SQLite Data Definition Language Queries: I Create CREATE TABLE table_name( columnl datatype, column2 datatype, columnn datatype) í I Alter ALTER TABLE tab1e_name ADD COLUMN column_def; I Rename ALTER TABLE table_name RENAME TO new_tab1e_name; I Drop DROP TABLE table_name; ïhelfi; contents? Copyright © Vengatesh. s slide 7/12
  8. 8. SQLite Queries (Cont. ..) SQLite Data Manipulation Language Queries: I Insert INSERT INTO table_name (columnl, column2, . . . .columnN) VALUES(Value1, Va1ue2, . . . . . va1ueN); I Update UPDATE tab1e_name SET columnl = valuel, co1umn2 = value2, . ..columnN = valueN WHERE conditions, ‘ I Delete DELETE FROM table_name WHERE condition; SQLite Data Query Language Queries: I Select SELECT expressions FROM table_name WHERE conditions; Ïcontents? Copyright © Vengatesh. s slide 8/12
  9. 9. Android SQLite Built-in SQLite database Main packages of SQLite android. database. sqlite Provides Helper class to manage all operation in database. Cursor to fetch all data from database. ïhelp? : contents? Copyright © Vengatesh. s slide 9/12
  10. 10. DataBase Helper I Manages all operations related to database. I Automatically manages creation and update of the database. Example: public class DBHe1per extends SQLiteOpenHe1per { String DATABASEÍNAME : "testDB"; String DA"ABASE_CREATE = "CREATE TABLE Contacts (ID INT PRIMARY KEY, " + "NAME TEXT NOT NULL, EMAIL TEXT NOT NULL); "¡ public DBHe1per(){ super(context, DATABASE_NAME, null, 1); public void onCreate(SQLiteDatabase db) { db. execSQL(DATABASE_CREATE); public void onUpgrade(SQLiteDatabase database, int oldversion, int newVersion) { db. execSQL("DROP TABLE IF EXISTS contacts"); onCreate(db); i contents? Copyright © Vengatesh. s slide 10/ 12
  11. 11. Cursor Retrieves data from database SQLite query method returns a Cursor object. Example : Cursor Cursor = db. query("table_name", new String[] {KEY_ROWID, KEY_NAME, KEY_EMAIL}, null, null, null, null); cursoLmoVeToFirstU; while (cursor. isAfterLast() = = false) { Toast. makToast(this, cursor. getString(1), Toast. LENGTH_SHORT). show; cursor. moveToNext(); Ïcontents? Copyrfit © Venrgflafihs slide 11/12
  12. 12. Thank You ihelpi’; contents? Copyright © Vengatesh. s rlide 12/ 12

×