DKU-MUST Mobile ICT Education Center 12. Data Storage and Management.

Slides:



Advertisements
Similar presentations
Chapter 10: Designing Databases
Advertisements

CIT 613: Relational Database Development using SQL Introduction to SQL.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
CSC 2720 Building Web Applications Database and SQL.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Information systems and databases Database information systems Read the textbook: Chapter 2: Information systems and databases FOR MORE INFO...
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
SEMESTER 1, 2013/2014 DB2 APPLICATION DEVELOPMENT OVERVIEW.
Chapter 12 Information Systems. Spreadsheets Databases 12-2.
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
 Introduction Introduction  Purpose of Database SystemsPurpose of Database Systems  Levels of Abstraction Levels of Abstraction  Instances and Schemas.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 13 Database Management Systems: Getting Data Together.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Database Technical Session By: Prof. Adarsh Patel.
Introduction to SQL Steve Perry
Simple Database.
Information Systems: Databases Define the role of general information systems Describe the elements of a database management system (DBMS) Describe the.
Python MySQL Database Access
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Dr. Mohamed Osman Hegazi 1 Database Systems Concepts Database Systems Concepts Course Outlines: Introduction to Databases and DBMS. Database System Concepts.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SQL Structured Query Language Programming Course.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Introduction to the new mainframe © Copyright IBM Corp., All rights reserved. Chapter 12 Understanding database managers on z/OS.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
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.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The concept of Data, Information and Knowledge  The fundamental terms:  Database and database system  Database.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
CIT 613: Relational Database Development using SQL Introduction to SQL DeSiaMorePowered by DeSiaMore 1.
Basics of JDBC Session 14.
1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql,
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Databases and SQL CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
ISC321 Database Systems I Chapter 2: Overview of Database Languages and Architectures Fall 2015 Dr. Abdullah Almutairi.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Introduction to Database Programming with Python Gary Stewart
CS371m - Mobile Computing Persistence - SQLite. 2 In case you have not taken 347: Data Management or worked with databases as part of a job, internship,
3 A Guide to MySQL.
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Mobile Applications (Android Programming)
SQLite in Android Landon Cox March 2, 2017.
Mobile Applications (Android Programming)
Android Application SQLite 1.
Android Database using SQLite
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Database Management Systems
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

DKU-MUST Mobile ICT Education Center 12. Data Storage and Management

Page  2 Goal Learn the basic concepts of database. Learn how to use the SQLite. App development using SQLite. Learn how to use the SQLite GUI Tool.

Page  3 1. SQLite Basic ▶ Basic concepts of database  Overview the SQLite SQLite is a relational database management system contained in a small C programming library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it. SQLite is ACID-compliant and implements most of the SQL standard, using a dynamically and weakly typed SQL syntax that does not guarantee the domain integrity. SQLite is a popular choice as embedded database for local/client storage in application software such as web browsers. It is arguably the most widely deployed database engine, as it is used today by several widespread browsers, operating systems, and embedded systems, among others. SQLite has many bindings to programming languages.

Page  4 1. SQLite Basic ▶ Basic concepts of database  Database definition A database is an organized collection of data. The data is typically organized to model relevant aspects of reality(for example, the availability of rooms in hotels), in a way that supports processes requiring this information(for example, finding a hotel with vacancies). Database management systems (DBMSs) are specially designed applications that interact with the user, other applications, and the database itself to capture and analyze data. A general-purpose database management system(DBMS) is a software system designed to allow the definition, creation, querying, update, and administration of databases. Well-known DBMSs include MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Microsoft Access, Oracle, SAP, dBASE, FoxPro, and IBM DB2. A database is not generally portable across different DBMS, but different DBMSs can inter-operate by using standards such as SQL and ODBC or JDBC to allow a single application to work with more than one database.

Page  5  Relational Database A relational database is a database that has a collection of tables of data items, all of which is formally described and organized according to the relational model. The term is in contrast to only one table as the database, and in contrast to other models which also have many tables in one database. In the relational model, each table schema must identify a primary column used for identifying a row called the primary key. Tables can relate by using a foreign key that points to the primary key. The relational model offers various levels of refinement of the table relations called database normalization. (See Normalization below.) The database management system (DBMS) of a relational database is called an RDBMS, and is the software of a relational database. The relational database was first defined in June 1970 by Edgar Codd, of IBM's San Jose Research Laboratory. Codd's view of what qualifies as an RDBMS is summarized in Codd's 12 rules. A relational database has become the predominant choice in storing data. Other models besides the relational model include the hierarchical database model and the network model. 1. SQLite Basic ▶ Basic concepts of database

Page  6  Database-related terms 1. SQLite Basic ▶ Basic concepts of database Database Naver Database A DatabaseB Database Table B Table C Table Column Name Member Table Column Row

Page  7  Steps to build the database in the SQLite ① Create the Database ↓ ② Create the Table ↓ ③ Input the Data ↓ ④ Select/Using the Data 1. SQLite Basic ▶ Build a database in SQLite Step. 1 Step. 2 Step. 3 Install the DBMS (Already Installed) Install the DBMS (Already Installed) Building the Database Building the Database Using the data that built in application Using the data that built in application

Page  8 [Practice 12-1] To build a database (1/7)  To build a Database Build a database in SQLite Access the command prompt  Project Info. Project Name : Project12_1 Package Name : com.cookandroid.project12_1 build SDK : Goolge API 15 or 16 Minimum Required SDK : API 15 or 16 Activity Name : Project12_1Activity Layout Name : main Title : Project12_1 First, Run the project Because AVD is Running 이번 실습은 프로젝트를 실행해서 우선 AVD 를 가동해야 한다. 1. SQLite Basic ▶ Build a database in SQLite

Page  9  Run the adb.exe Run the command prompt → Run the adb.exe Adb.exe path is “androidsdk\platform-tools\” 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (2/7)

Page  10  Ready access to SQLite 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (3/7)

Page  11  ① Create a Database 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (4/7)

Page  12  ② Create a table 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (5/7)

Page  13  ③ Input the Data 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (6/7)

Page  14  ④ Using and select… the data 1. SQLite Basic ▶ Build a database in SQLite [Practice 12-1] To build a database (7/7)

Page  15  Create the myDB(Database), and Create the table [Self Test 12-1] 1. SQLite Basic ▶ Build a database in SQLite Product NamePrice Date of Manufacture Manufacturing Company Remaining quantity TV Samsung55 Computer LG7 Monitor Daewoo33 Printer HP24

Page  16  SQLite behavior for the development of Android App Using the SQLiteOpenHelper Class, SQLiteDatabase Class, Cursor Interface 2. Using the SQLite ▶ SQLite Programming SQLiteOpenHelper Class SQLite Database SQLite Database Inherit override Inherit override SQLiteDatabase Class Cursor Interface Create the Database Create the Table Execution of the SQL Query Move the Cursor

Page  17  Mainly used the method in each class 2. Using the SQLite ▶ SQLite Programming Class or InterfaceMethodMain purpose SQLiteOpenHelper Class ConstructorCreate the Database onCreate()Create the Table onUpgrade()Delete the Table and recreate getReadableDatabase()Open read-only DB, return the SQLiteDatabase getWritableDatabase() Open for reading and writing DB, Return the SQLiteDatabase SQLiteDatabase Class execSQL()Execute the SQL Query(Insert, Update, Delete) close()Close the DB Query(), rawQuery()After running, the select cursor returns Cursor Interface moveToFirst()Move to the first row of the cursor moveToLast()Move to the last row of the cursor moveToNext()Move to the next row of the cursor

Page  18 [Practice 12-2] Create the DB management singer name App (1/9)  Create the singer name DB management App Insert and Select the name of Singer group in the Database  Project Info. Project Name : Project12_2 Package Name : com.cookandroid.project12_2 build SDK : Goolge API 15 or 16 Minimum Required SDK : API 15 or 16 Activity Name : Project12_2Activity Layout Name : main Title : Project12_2 2. Using the SQLite ▶ SQLite Programming

Page  19  Design the Screen LinearLayou 1 : 1 TextView, 1 EditText(edtName) LinearLayou 2 : 1 TextView, 1 EditText(edtNumber) LinearLayou 3 : 3 Button(btnInit, btnInsert, btnSelect) LinearLayou 4 : 2 EditText(edtNameResult, edtNumberResult) 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (2/9)

Page  20  Java Coding 1 Define a class that inherits from SQLiteOpenHelper class Modify the constructor 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (3/9)

Page  21  Java Coding 2 : Coding the onCreate( ) and onUpgrade( ) method of the myDBHelper class onCreate( ) method : Coding the create a table code onUpgrade( ) method : Coding the delete table and recreate table code 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (4/9)

Page  22  Java coding 3 : Coding the main Activity class The newly created myDBHelper class variables / Four variables respond to EditText The three variables respond to the Button / SQLiteDatabase Class variabless 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (5/9)

Page  23  Java coding 4 Coding the Listener to run, when you click the 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (6/9)

Page  24  Java coding 5 When you click the, Coding the Listener for input the value of the EditText 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (7/9)

Page  25  Java Coding 6 When you click the, coding the Listener for show the all data in the table. (printed on the bottom of the EditText) 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (8/9)

Page  26  Run and the results confirm After running the project, enter the required information and confirm the results At the command prompt, confirm the contents of the groupDB 2. Using the SQLite ▶ SQLite Programming [Practice 12-2] Create the DB management singer name App (9/9)

Page  27  Update the [Practice 12-2] Add a and button ① 이름에 그룹 이름과 변경된 인원을 입력한 후 을 클릭하면 해당 그룹의 인원이 변경되도록 한다. ② 이름에 그룹 이름을 입력하고 를 클릭하면 해당 그룹의 행이 삭제되도록 한다. ③,, 를 클릭하면 그 결과가 즉시 화면에 보이도록 한다. [Self Test 12-2] 2. Using the SQLite ▶ SQLite Programming

Page  28  SQLite Database Browser (1/2) : Create a database and table 2. Using the SQLite ▶ Using SQLite GUI Tool

Page  29  SQLite Database Browser (2/2): Input the data 생성한 데이터베이스 파일은 DDMS 를 통해 AVD 에 넣어서 (Push) 사용할 수 있다. 2. Using the SQLite ▶ Using SQLite GUI Tool

Page  30  [ 실습 12-2] 의 groupDB 데이터베이스 파일을 DDMS 를 이용해서 AVD 에서 PC 로 가져 온 (Pull) 후 수정한다. SQLite Database Browser 에서 가수 그룹 이름을 모두 한글로 고치고 가수그룹을 몇 개 더 입력해보자. 그리고 AVD 에 다시 넣은 (Push) 후 [ 실습 12-2] 를 실행해서 데이터가 잘 조회되는지 확인한다. [Self Test 12-3] 2. Using the SQLite ▶ Using SQLite GUI Tool

Page  31  SQLite Developer 2. Using the SQLite ▶ Using SQLite GUI Tool

Page  32 Summary 1.Database-related terms Data, Table, Database, DBMS, column(column or field), column name, Type of data(data type), row, SQL 2.The database type of SQL statements Create a table : CREATE TABLE Input the data : INSERT INTO Update the data : UPDATE Delete the data : DELETE FROM Select the data : SELECT 3.SQLite Progamming Using the SQLiteOpenHelper Class, SQLiteDatabase Class and Cursor Interface

DKU-MUST Mobile ICT Education Center