SlideShare a Scribd company logo
Introduction:
Databases:
Databasesare an organized collectionof logicallyrelated data, whichcanbe easilyaccessedand
manipulatedusingadatabase systemmanager.There existseveral modelsof databases,most
notablyrelational databases.
Relational databases:
Relational databasesare databasesbasedonrelational model.Virtuallyall relational database
systemsuse SQL(StructuredQueryLanguage) formaintainingdatabases.
Relational model:
Relational model organisesdataintoa one or more tables,a table ismade of columnsand rows.
Each row is calledarecord andis identifiedbyaunique key.Columnsare calledattributes.Inmost
cases,a table representsone entitytype,forexample:Client,whererowsare the instancesof that
type for example:Ali.
DBMS (Database management system):
DBMS iscomputersoftware thatinteractswithend-users(anenduserissomeone whousesa
productor intendsto,opposite tothose whomaintainorsupportit.) Theyare basedondatabase
modelsbutall of themsupportrelational databases since1980. There existmanyDBMS but the most
popularsystemsare Oracle,MySQL,MicrosoftSQL server.
SQL (Structured Query Language):
SQL is domain-specificlanguage (alanguage that’susedinaspecificapplication,contrarytoa
general-purpose programminglanguages) usedinprogrammingandin relational databases
managementsystems.
SQL was originallybasedonrelationalalgebraand tuple relational calculus.SQLis divided intothree
mainelements(some people classifythemassublanguages)
Data Query Language (DQL): isusedto make queriesindatabase.
Data DefinitionLanguage (DDL): isusedto create and delete ormodifydatabasesandtables
Data control language (DCL): isusedto control access(permissions) todatastoredindatabases.
Data manipulationlanguage (DML):Is usedto insert,deleteandmodifying(updating) dataina
database
MySQL:
MySQL is an opensource Relational Database ManagementSystem,itwasownedandsponsoredby
MySQL AB, and nowisownedbyOracle.Several paid versionsexistwhich offeradditional
functionalities. ItiswidelyusedinmanybigwebsitessuchasGoogle,Facebook,Twitterand
YouTube.
MySQL supported types:
 TINYINT.
 SMALLINT.
 MEDIUMINT.
 INT or INTEGER.
 BIGINT.
 FLOAT.
 DOUBLE, DOUBLE PRECISION,REAL: DECIMAL, NUMERIC.
 DATE.
 DATETIME.
 TIMESTAMP.
 TIME.
 YEAR.
 CHAR.
 VARCHAR.
 TINYBLOB,TINYTEXT.
 BLOB, TEXT.
 MEDIUMBLOB, MEDIUMTEXT.
 LONGBLOB,LONGTEXT.
 ENUM.
 SET.
Advantages of MySQL:
 Easy to workwith:
o MySQL can be installedveryeasily.
 Feature rich:
o MySQL supportsa lot of SQL functionalities
 Data security:
o It isknownto be most secure andreliable database managementsystem.
 Scalability:
o MySQL can handle alotof data efficiently.
 Speed:
o MySQL is knownforitsspeedandefficientwork.
Disadvantage of MySQL:
 MySQL lack some featuresthatsome applicationmayrequire( itwasnot intendedtodo
everything)
 Stagnateddevelopment: MySQLisstill anopen-source,buthasnotmuch improvedsince its
acquisition.
When touse MYSQL:
Highsecurity: whenyouneedhighsecuritytoprotectyourdata bases,mysql can offeravery
reliable protectionfordata-accessinasimple way.
When not to use MySQL:
Concurrency: AlthoughMySQLperformreallywell withreadoperations,concurrentread-write
operationscanbe problematic.
Lack of features: Since MySQL doesn’timplementfullSQLstandards,itlackssome feature thatyour
applicationmayneed.
SQLite:
A verypowerful embedded Relational DatabasesManagementSystem.ContrarytootherRDBMS,
SQLite isnot a client-serverDatabase engine. Butisinstead,embeddedintothe endapplication.
SQLite isverypopularchoice as an embedded-database adatabase whichisintegrateddirectlyinto
an applicationthatrequiresaccesstostoreddata,and ishiddenfromthe applicationuser) for
embedded systemssuchasmobile phones,SQLite isknowntobe efficientandfastdue to its
integrationdirectlyinthe application,itoffersavaried setof toolstohandle all sortof data with
much lessconstraints andease comparedtohosted,serverbaseddatabases.
SQLite supportedtypes:
 NULL.
 INTEGER.
 REAL.
 TEXT.
 BLOB.
Advantage of SQLite:
File based:the data consistsof one single file storedonthe disk,whichmakesitextremelyportable
and easyto use.
Lightweight: SQLite isverylightweightdatabase whichcanusedinembeddedsystemslike Mobile
phones,TV,cameras .
Better performance: readingandwritingdata isveryfast inSQLite. Itonlyloadsdata it needsrather
than loadingthe whole file inmemory. Onlypartsthatare changedwill be overwritten.
No installationneeded: youjustneedtodownloadthe libraryandyouare readyto go.
Reliable: itcontinuouslyupdatescontent,notmuchworkislostdue to powerfailure orcrash.
Portable: it’sportable acrossall OS,and differentplatforms. Itcanalsobe usedwith many
programminglanguage withoutanycomputabilityissues.
Accessible: SQLite isaccessible throughwide varietyof thirdpartytools.
Reduce cost and complexity:Contentcanbe accessedand updatedeasily usingSQLqueries. Itcan
be easilyextendedjustbyaddingacolumn or two,andalso preserve backwardcompatibility
SQLite disadvantage:
 Most databasesare limitedto2GB.
 Cannothandle highhttptraffic.
When touse SQLite?
Embeddedapplications: all applicationsthat needportability,anddonotrequire extensionlike
mobile applications
Disk access replacement:applicationsthatwrite/readfilesinto/fromdiskdirectlycanswitchto
SQLite andbenefice fromthe functionalitiesandsimplicitythatSQLoffers.
Testing.
When not to use SQLite?
Workingan applicationwhere manyusersaccessto the same database at the same time,
Applicationsrequiringhighwriting volume:SQLite doesallow onlyone singlewrite operationatthe
same time (file locking).
Case study: Inserting username and password into
database.
Describingthe scheme of table “Login”:
private static final String createTable= "Create table if not exists
"+Clients.TABLE_NAME+" ( "+ Clients.ID + " integer PRIMARY KEY
AUTOINCREMENT,"+Clients.USER_COLUMN+ " text,"
+ Clients.PASS_COLUMN+ " text)";
Usingof static class DataBaseHelper to which is a subclass of SQLiteOpenHelpertohelpus manage
database (creating and upgrading database),then usingan objectof this subclassto insert, delete
and other operations.
private static class DataBaseHelper extends SQLiteOpenHelper{
Context context;
public DataBaseHelper(Context context){
super(context, DBName, null, DBVersion);
this.context = context;
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL(createTable);
}
We useda helperclass calledDBManger to manage all SQL queries: UsingmyDataBaseHelper
Object(instance ofDataBaseHelper) to create a WritableDatabase.
public DBManager(Context context){
myDataBaseHelper = new DataBaseHelper(context);
SQLdb = myDataBaseHelper.getWritableDatabase();
}
Performinginsertquery on the database.
public long insert(ContentValues values){
return SQLdb.insert(Clients.TABLE_NAME, "", values);
}
Insert iscalled from the mainActivity :
ContentValues values = new ContentValues();
values.put(DBManager.Clients.USER_COLUMN, usernameString);
values.put(DBManager.Clients.PASS_COLUMN, passwordString);
id = myDBManager.insert(values);

More Related Content

What's hot (19)

PDF
WEB PROGRAMMING USING ASP.NET
DhruvVekariya3
 
DOC
DBMS Practical File
Dushmanta Nath
 
PDF
Comparative study of no sql document, column store databases and evaluation o...
IJDMS
 
PDF
Mysql
Raghu nath
 
PPTX
Advantage & Disadvantage of MySQL
KentAnderson43
 
PPTX
SQLite - Overview
Emanuele Bartolesi
 
PPTX
Heterogeneous databases
ravikamma26
 
PDF
A Comparison between Relational Databases and NoSQL Databases
ijtsrd
 
PPTX
Introduction to database with ms access.hetvii
07HetviBhagat
 
ODP
Introduction4 SQLite
Stanley Huang
 
PDF
NoSQL-Database-Concepts
Bhaskar Gunda
 
PDF
Brief introduction to NoSQL by fas mosleh
Fas (Feisal) Mosleh
 
DOC
11g architecture
Manohar Jha
 
PDF
Asp.net interview questions
Akhil Mittal
 
PPTX
History of database processing module 1 (2)
chottu89
 
PPT
Creating database
Hitesh Kumar Markam
 
PPTX
Kaashiv SQL Server Interview Questions Presentation
kaashiv1
 
PPT
Nosql
Dhaval Barot
 
WEB PROGRAMMING USING ASP.NET
DhruvVekariya3
 
DBMS Practical File
Dushmanta Nath
 
Comparative study of no sql document, column store databases and evaluation o...
IJDMS
 
Mysql
Raghu nath
 
Advantage & Disadvantage of MySQL
KentAnderson43
 
SQLite - Overview
Emanuele Bartolesi
 
Heterogeneous databases
ravikamma26
 
A Comparison between Relational Databases and NoSQL Databases
ijtsrd
 
Introduction to database with ms access.hetvii
07HetviBhagat
 
Introduction4 SQLite
Stanley Huang
 
NoSQL-Database-Concepts
Bhaskar Gunda
 
Brief introduction to NoSQL by fas mosleh
Fas (Feisal) Mosleh
 
11g architecture
Manohar Jha
 
Asp.net interview questions
Akhil Mittal
 
History of database processing module 1 (2)
chottu89
 
Creating database
Hitesh Kumar Markam
 
Kaashiv SQL Server Interview Questions Presentation
kaashiv1
 

Similar to Android project (1) (20)

PPTX
Dbms and sqlpptx
thesupermanreturns
 
PDF
Lecture 5: Storage: Saving Data Database, Files & Preferences
Ahsanul Karim
 
PDF
database1.pdf
prashanna13
 
PPTX
IP-Lesson_Planning(Unit4 - Database concepts and SQL).pptx
ssuser61d324
 
PPT
Class363 1
Prîñçë Šãllü
 
PDF
WHAT IS A DBMS? EXPLAIN DIFFERENT MYSQL COMMANDS AND CONSTRAINTS OF THE SAME.
`Shweta Bhavsar
 
PPTX
MODERN DATABASES (2).pptx in which modern types of data bases
lovepreet33653
 
PPTX
Ch-11 Relational Databases.pptx
ShadowDawg
 
PPTX
Data Manipulation ppt. for BSIT students
julie4baxtii
 
PDF
Class 10TH INFORMATIONAL TECHNOLOGY.pdf
AAFREEN SHAIKH
 
PPT
DBMS ACCESS programming and learning .ppt
MANISH169648
 
PPTX
Presentation DBMS (1)
Ali Raza
 
PPTX
DEE 431 Introduction to Mysql Slide 3
YOGESH SINGH
 
PDF
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Amanda Lam
 
PDF
Database-SQL -in computer appliacation of pharmcay
DeviPriyaMohan1
 
DOCX
DBMS PART 1.docx
GudduKumar408051
 
PPT
Unit4_Lecture-sql.ppt and data science relate
umang2782love
 
PDF
Sq lite module5
Highervista
 
PPTX
Complete first chapter rdbm 17332
Tushar Wagh
 
Dbms and sqlpptx
thesupermanreturns
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Ahsanul Karim
 
database1.pdf
prashanna13
 
IP-Lesson_Planning(Unit4 - Database concepts and SQL).pptx
ssuser61d324
 
WHAT IS A DBMS? EXPLAIN DIFFERENT MYSQL COMMANDS AND CONSTRAINTS OF THE SAME.
`Shweta Bhavsar
 
MODERN DATABASES (2).pptx in which modern types of data bases
lovepreet33653
 
Ch-11 Relational Databases.pptx
ShadowDawg
 
Data Manipulation ppt. for BSIT students
julie4baxtii
 
Class 10TH INFORMATIONAL TECHNOLOGY.pdf
AAFREEN SHAIKH
 
DBMS ACCESS programming and learning .ppt
MANISH169648
 
Presentation DBMS (1)
Ali Raza
 
DEE 431 Introduction to Mysql Slide 3
YOGESH SINGH
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Amanda Lam
 
Database-SQL -in computer appliacation of pharmcay
DeviPriyaMohan1
 
DBMS PART 1.docx
GudduKumar408051
 
Unit4_Lecture-sql.ppt and data science relate
umang2782love
 
Sq lite module5
Highervista
 
Complete first chapter rdbm 17332
Tushar Wagh
 
Ad

Recently uploaded (20)

PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Ad

Android project (1)

  • 1. Introduction: Databases: Databasesare an organized collectionof logicallyrelated data, whichcanbe easilyaccessedand manipulatedusingadatabase systemmanager.There existseveral modelsof databases,most notablyrelational databases. Relational databases: Relational databasesare databasesbasedonrelational model.Virtuallyall relational database systemsuse SQL(StructuredQueryLanguage) formaintainingdatabases. Relational model: Relational model organisesdataintoa one or more tables,a table ismade of columnsand rows. Each row is calledarecord andis identifiedbyaunique key.Columnsare calledattributes.Inmost cases,a table representsone entitytype,forexample:Client,whererowsare the instancesof that type for example:Ali. DBMS (Database management system): DBMS iscomputersoftware thatinteractswithend-users(anenduserissomeone whousesa productor intendsto,opposite tothose whomaintainorsupportit.) Theyare basedondatabase modelsbutall of themsupportrelational databases since1980. There existmanyDBMS but the most popularsystemsare Oracle,MySQL,MicrosoftSQL server. SQL (Structured Query Language): SQL is domain-specificlanguage (alanguage that’susedinaspecificapplication,contrarytoa general-purpose programminglanguages) usedinprogrammingandin relational databases managementsystems. SQL was originallybasedonrelationalalgebraand tuple relational calculus.SQLis divided intothree mainelements(some people classifythemassublanguages) Data Query Language (DQL): isusedto make queriesindatabase. Data DefinitionLanguage (DDL): isusedto create and delete ormodifydatabasesandtables Data control language (DCL): isusedto control access(permissions) todatastoredindatabases. Data manipulationlanguage (DML):Is usedto insert,deleteandmodifying(updating) dataina database
  • 2. MySQL: MySQL is an opensource Relational Database ManagementSystem,itwasownedandsponsoredby MySQL AB, and nowisownedbyOracle.Several paid versionsexistwhich offeradditional functionalities. ItiswidelyusedinmanybigwebsitessuchasGoogle,Facebook,Twitterand YouTube. MySQL supported types:  TINYINT.  SMALLINT.  MEDIUMINT.  INT or INTEGER.  BIGINT.  FLOAT.  DOUBLE, DOUBLE PRECISION,REAL: DECIMAL, NUMERIC.  DATE.  DATETIME.  TIMESTAMP.  TIME.  YEAR.  CHAR.  VARCHAR.  TINYBLOB,TINYTEXT.  BLOB, TEXT.  MEDIUMBLOB, MEDIUMTEXT.  LONGBLOB,LONGTEXT.  ENUM.  SET. Advantages of MySQL:  Easy to workwith: o MySQL can be installedveryeasily.  Feature rich: o MySQL supportsa lot of SQL functionalities  Data security: o It isknownto be most secure andreliable database managementsystem.  Scalability: o MySQL can handle alotof data efficiently.  Speed: o MySQL is knownforitsspeedandefficientwork. Disadvantage of MySQL:  MySQL lack some featuresthatsome applicationmayrequire( itwasnot intendedtodo everything)
  • 3.  Stagnateddevelopment: MySQLisstill anopen-source,buthasnotmuch improvedsince its acquisition. When touse MYSQL: Highsecurity: whenyouneedhighsecuritytoprotectyourdata bases,mysql can offeravery reliable protectionfordata-accessinasimple way. When not to use MySQL: Concurrency: AlthoughMySQLperformreallywell withreadoperations,concurrentread-write operationscanbe problematic. Lack of features: Since MySQL doesn’timplementfullSQLstandards,itlackssome feature thatyour applicationmayneed. SQLite: A verypowerful embedded Relational DatabasesManagementSystem.ContrarytootherRDBMS, SQLite isnot a client-serverDatabase engine. Butisinstead,embeddedintothe endapplication. SQLite isverypopularchoice as an embedded-database adatabase whichisintegrateddirectlyinto an applicationthatrequiresaccesstostoreddata,and ishiddenfromthe applicationuser) for embedded systemssuchasmobile phones,SQLite isknowntobe efficientandfastdue to its integrationdirectlyinthe application,itoffersavaried setof toolstohandle all sortof data with much lessconstraints andease comparedtohosted,serverbaseddatabases. SQLite supportedtypes:  NULL.  INTEGER.  REAL.  TEXT.  BLOB. Advantage of SQLite: File based:the data consistsof one single file storedonthe disk,whichmakesitextremelyportable and easyto use. Lightweight: SQLite isverylightweightdatabase whichcanusedinembeddedsystemslike Mobile phones,TV,cameras . Better performance: readingandwritingdata isveryfast inSQLite. Itonlyloadsdata it needsrather than loadingthe whole file inmemory. Onlypartsthatare changedwill be overwritten. No installationneeded: youjustneedtodownloadthe libraryandyouare readyto go. Reliable: itcontinuouslyupdatescontent,notmuchworkislostdue to powerfailure orcrash. Portable: it’sportable acrossall OS,and differentplatforms. Itcanalsobe usedwith many programminglanguage withoutanycomputabilityissues.
  • 4. Accessible: SQLite isaccessible throughwide varietyof thirdpartytools. Reduce cost and complexity:Contentcanbe accessedand updatedeasily usingSQLqueries. Itcan be easilyextendedjustbyaddingacolumn or two,andalso preserve backwardcompatibility SQLite disadvantage:  Most databasesare limitedto2GB.  Cannothandle highhttptraffic. When touse SQLite? Embeddedapplications: all applicationsthat needportability,anddonotrequire extensionlike mobile applications Disk access replacement:applicationsthatwrite/readfilesinto/fromdiskdirectlycanswitchto SQLite andbenefice fromthe functionalitiesandsimplicitythatSQLoffers. Testing. When not to use SQLite? Workingan applicationwhere manyusersaccessto the same database at the same time, Applicationsrequiringhighwriting volume:SQLite doesallow onlyone singlewrite operationatthe same time (file locking). Case study: Inserting username and password into database. Describingthe scheme of table “Login”: private static final String createTable= "Create table if not exists "+Clients.TABLE_NAME+" ( "+ Clients.ID + " integer PRIMARY KEY AUTOINCREMENT,"+Clients.USER_COLUMN+ " text," + Clients.PASS_COLUMN+ " text)"; Usingof static class DataBaseHelper to which is a subclass of SQLiteOpenHelpertohelpus manage database (creating and upgrading database),then usingan objectof this subclassto insert, delete and other operations. private static class DataBaseHelper extends SQLiteOpenHelper{ Context context; public DataBaseHelper(Context context){ super(context, DBName, null, DBVersion); this.context = context; } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { sqLiteDatabase.execSQL(createTable); }
  • 5. We useda helperclass calledDBManger to manage all SQL queries: UsingmyDataBaseHelper Object(instance ofDataBaseHelper) to create a WritableDatabase. public DBManager(Context context){ myDataBaseHelper = new DataBaseHelper(context); SQLdb = myDataBaseHelper.getWritableDatabase(); } Performinginsertquery on the database. public long insert(ContentValues values){ return SQLdb.insert(Clients.TABLE_NAME, "", values); } Insert iscalled from the mainActivity : ContentValues values = new ContentValues(); values.put(DBManager.Clients.USER_COLUMN, usernameString); values.put(DBManager.Clients.PASS_COLUMN, passwordString); id = myDBManager.insert(values);