Lecture 8: Database Topics: Basic SQLite Operations.

Slides:



Advertisements
Similar presentations
DB glossary (focus on typical SQL RDBMS, not XQuery or SPARQL)
Advertisements

CE881: Mobile and Social Application Programming Flexible Data Handling with Integrity: SQLite Simon M. Lucas.
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Keys, Referential Integrity and PHP One to Many on the Web.
Quick-and-dirty.  Commands end in a semi-colon ◦ If you forget, another prompt line shows up  Either continue the command or…  End it with a semi-colon.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
SQLLite and Java CS-328 Dick Steflik. SQLLite Embedded RDBMS ACID Compliant Size – about 257 Kbytes Not a client/server architecture –Accessed via function.
SQLite 1 CS440. What is SQLite?  Open Source Database embedded in Android  SQL syntax  Requires small memory at runtime (250 Kbytes)  Lightweight.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
Database Lecture # 1 By Ubaid Ullah.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
SQLite Android Club SQLite About onCreate Insert Select Update Delete onUpdate.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Plotting in Microsoft Excel. 1) Enter your data into the Excel spreadsheet in table format. Your data should have column headers, row headers and data.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
Excel 2010 Formatting Columns and Rows Excel 2010 / Mr. Bitenas In this lesson you will learn how to insert, delete, and resize Columns and Rows.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
SQLite (part deux) 1 CS440. Traditional Model View Controller (MVC) CS440 2.
Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions.
SQLite DB Storing Data in Android RAVI GAURAV PANDEY 1.
Android - SQLite Database 12/10/2015. Introduction SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with.
SQlite. SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql,
April 2002 Information Systems Design John Ogden & John Wordsworth 1 Database Design SQL (1) John Wordsworth Department of Computer Science The University.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
DATA TODAY L. Grewe. Whole range of solutions This class  Focus on learning Mid-end Traditional Data Systems = Relational Database Systems  Note: if.
Introduction to Database Programming with Python Gary Stewart
Database Programming Code Dissection. Layered Approach Presentation (Activity) DbSampleActivity.java DataAccess (DataSource) CommentsDataSource.java MySQLiteHelper.java.
Making content providers
3 A Guide to MySQL.
Database Access with SQL
Cosc 5/4730 Sqlite primer.
CS SQL.
SQLite in Android Landon Cox March 2, 2017.
Insert, Update and the rest…
Mobile Applications (Android Programming)
Android Application SQLite 1.
© 2016, Mike Murach & Associates, Inc.
SQL – More Table Constraints
Android Database using SQLite
CS311 Database Management system
Database application MySQL Database and PhpMyAdmin
Chapter 4 MS ACCESS DATABASE.
Mobile Computing With Android ACST Android Database Storage Part 2
SQL Standard Query Language Good for manipulating a Database
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
مقدمة في قواعد البيانات
Rob Gleasure robgleasure.com
Data Management Innovations 2017 High level overview of DB
Keyboarding.
Android Developer Fundamentals V2
Chapter 4 Introduction to MySQL.
ListView A view that shows items in a vertically scrolling list. The items come from the ListAdapter associated with this view. ListAdapter is used to.
Updating Databases With Open SQL
Department of School of Computing and Engineering
SQLLite and Android.
Database SQL.
Lecture 8: Database Topics: Basic SQLite Operations.
Mobile Programming Dr. Mohsin Ali Memon.
SQL – Application Persistence Design Patterns
Updating Databases With Open SQL
SQL (Structured Query Language)
Presentation transcript:

Lecture 8: Database Topics: Basic SQLite Operations

Today’s class: Concepts Database, Table, Primary Key (Lecture) SQL Commands Android (code) Example of “Characters” database Create, Insert, Delete, Query

Database Bunch of tables having column headers where you store data—one datum in each row. Table: Characters Table: Appearance ID Name Home 1 John Winterfell 2 Tyrion Casterly Rock 3 Daenerys Dragon Stone Episode CharacterID Appeared 1 10 2 5 3 7 9 Power manage: wake lock, reboot.

Create and Drop Tables SQL: CREATE TABLE Characters ( ID INT PRIMARY KEY, NAME TEXT, HOME TEXT ); Table: Characters ID Name Home SQL: Power manage: wake lock, reboot. DROP TABLE IF EXISTS Characters;

Insert and Delete Rows SQL: Table: Characters INSERT INTO Characters VALUES (1, ‘John’, ‘Winterfell’); VALUES (2, ‘Tyrion’, ‘Casterly Rock’); ID Name Home 1 John Winterfell 2 Tyrion Casterly Rock SQL: Table: Characters DELETE FROM Characters WHERE Name = ‘John’; ID Name Home 2 Tyrion Casterly Rock Power manage: wake lock, reboot.

Query SELECT * FROM Characters WHERE ID < 3; SQL: Table: Characters SELECT * FROM Characters WHERE ID < 3; ID Name Home 1 John Winterfell 2 Tyrion Casterly Rock 3 Daenerys Dragon Stone SQL: Table: Characters SELECT Name, Episode, Appeared FROM Characters, Appearance WHERE ID = CharacterID AND Episode = 1 AND Appeared < 7 ID Name Home Power manage: wake lock, reboot.

Query SELECT Name, Episode, Appeared FROM Characters, Appearance Table: Characters SQL: ID Name Home 1 John Winterfell 2 Tyrion Casterly Rock 3 Daenerys Dragon Stone SELECT Name, Episode, Appeared FROM Characters, Appearance WHERE ID = CharacterID AND Episode = 1 AND Appeared < 7 Table: Appearance Episode CharacterID Appeared 1 10 2 5 3 7 9 Output: Power manage: wake lock, reboot. Name Episode Appeared Tyrion 1 5

Android SQLite (in 3 lines) What? How? Database Open/Create SQLiteDatabase db = this.openOrCreateDatabase (“SomeDB", Context.MODE_PRIVATE, null); Table Drop/Create Rows Insert/delete db.execSQL(“A SQL COMMAND”); Select Cursor c = db.rawQuery("SELECT …. “); c.moveToFirst(); c.getString(index); c.moveToNext(); Power manage: wake lock, reboot.

References (study these) https://developer.android.com/training/basics/data-storage/databases.html