+ All Categories
Home > Documents > LAB 4-Part 1 · 2020-02-24 · Introduction to SQLite: 4 • SQLite is a self-contained,...

LAB 4-Part 1 · 2020-02-24 · Introduction to SQLite: 4 • SQLite is a self-contained,...

Date post: 30-Mar-2020
Category:
Upload: others
View: 15 times
Download: 0 times
Share this document with a friend
24
Done by: L.Rawan ALAmri LAB 4-Part 1
Transcript

1

• Done by:

• L.Rawan ALAmri

LAB 4-Part 1

OUTLINE

INTRODUCTION

ARRAY REPRESENTATION

Classes

2

1

3

Introduction to SQLite

History

SQLite Introduction

4Introduction to SQLite:

• SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine

• It is the most used database engine in the world.

• It is free for use for any purpose, commercial or private. It is basically an embedded SQL database engine. Ordinary disk files can be easily read and write by SQLite because it does not have any separate server like SQL.

5Introduction to SQLite:

• Embedded RDBMS

• Size – about 257 Kbytes.

• Not a client/server architecture – Accessed via function calls from the application.

• Writing (insert, update, delete) locks the database, queries can be done in parallel

6History:

• It was designed by D. Richard Hipp for the purpose of no administration required for operating a program.

• in August 2000. As it is very lightweight compared to others like MySql and Oracle, it is called SQLite. Different versions of SQLite are released since 2000.

7Definitions:

• A relational database is a collection of data organized in tables.

• The tables are formally described. They consist of rows and columns.

• A table is a set of values that is organized using a model of vertical columns and horizontal rows. The columns are identified by their names.

• A schema of a database system is its structure described in a formal language, It defines the tables, the fields, relationships, views, indexes, procedures, functions, queues, triggers, and other elements.

• A database row represents a single, implicitly structured data item in a table. It is also called a tuple or a record.

• A column is a set of data values of a particular simple type, one for each row of the table.

8Data Type (Storage and classes):

• Each value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:

o NULL. The value is a NULL value.o INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes

depending on the magnitude of the value.o REAL. The value is a floating point value, stored as an 8-byte IEEE floating point

number.o TEXT. The value is a text string, stored using the database encoding (UTF-8, UTF-

16BE or UTF-16LE).o BLOB. The value is a blob of data, stored exactly as it was input.

9Data Type:

• Each value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:

o Storage and classes: NULL, text, and Integer value.o Boolean: stored as integer 0:false, 1:true.o Date and Time: text, real and Integer.

• for more datatype see this link:o https://www.sqlite.org/datatype3.html

10android.database.sqlite :

• Contains the SQLite database management classes that an application would use to manage its own private database.

• Classes:• SQLiteCloseable - An object created from a SQLiteCloseable that can be closed. • SQLiteCursor - A Cursor implementation that exposes results from a query on a

SQLiteDatabase.• SQLiteDatabase - Exposes methods to manage a SQLite database. • SQLiteOpenHelper - A helper class to manage database creation and version

management. • SQLiteProgram - A base class for compiled SQLite programs. • SQLiteQuery - A SQLite program that represents a query that reads the resulting

rows into a CursorWindow. • SQLiteQueryBuilder - a convenience class that helps build SQL queries to be sent

to SQLiteDatabase objects. • SQLiteStatement - A pre-compiled statement against a SQLiteDatabase that can

be reused.

11android.database.sqlite.SQLiteDatabase :

• Contains the methods for: creating, opening, closing, inserting, updating, deleting and quiring an SQLite database.

• open Or CreateDatabase( ): This method will open an existing database or create one in the application data area.

• Here is a good tutorial about it:

• https://www.javatpoint.com/android-sqlite-tutorial

12

Link to install SQLite:

• https://www.sqlite.org/download.html

❖ How to install SQLite for Windows:

• https://www.youtube.com/watch?v=wXEZZ2JT3-k

❖ How to install SQLite for MAC:

• https://www.youtube.com/watch?v=zOgyxa6typs

• https://www.youtube.com/watch?v=iyXYwNQC6ag

14

Extract zip file:

15

Paste on this path (for windows), Windows (C)>>paste the folder:

16

Rename the folder to “sqlite3”

17

Open system setting then>> advanced system setting:

18

Press on Path>> then Edit..:

19

1- New>>2- then write the path of sqlite3 folder as “C:\sqlite3”>> 3- press ok:

1

2

3

20

Open command prompt as admin:

21

Write command “sqlite3”:

Note: To quit write command “.quit”

22

Add new folder on desktop:

Name it “db”:

23

Change directory to “db” folder>> then create the database with tables and values:

24

THANKS


Recommended