23
PB204 DATABASE APPLICATION Jabatan Perdagangan POLITEKNIK SEBERANG PERAI

Chapter 1

Embed Size (px)

DESCRIPTION

PB204 Database Application Jabatan Perdagangan Politeknik Seberang Perai

Citation preview

Page 1: Chapter 1

PB204

DATABASE APPLICATION

Jabatan PerdaganganPOLITEKNIK SEBERANG PERAI

Page 2: Chapter 1

INTRODUCTION TO DATABASE SYSTEM INTRODUCTION TO DATABASE SYSTEM

1.0

Page 3: Chapter 1

Concept of Database System• How are data and information related?

Data is raw facts Information is data that is organized and meaningful Computers process data into information

• What is data integrity? Degree to which data is correct

Garbage in, garbage out (GIGO)—computer phrase that means you cannot create correct information from incorrect data

Garbage in Garbage out Data integrity is lost

Page 4: Chapter 1

Data and Information• What are the qualities of valuable information?

UsefulUsefulAccessibleAccessible

OrganizedOrganizedTimelyTimely

VerifiableVerifiable

AccurateAccurate

Cost-effectiveCost-effective

Page 5: Chapter 1

Data and Information (cont.)• The Hierarchy of Data

Database contains files, file contains records, record contains fields, field contains characters

Commerce Department Database

Student Class File

Matric No Name Date Of Birth10DPM10F1101 AZRI BIN ALI 30.4.199210DPM10F1102 FATIMAH BT ABDULLAH 18.6.199210DPM10F1103 FARISHA BT ZAHID 28.8.1992

field Names

records

fields

Field size 12formatInput maskCaption Matric NoDefault valueValidation ruleValidation textrequired YesAllow zero length NoIndexed Yes (No Duplicate)

maximum characters in student matric no field

Characteristics of Matric No Field

Page 6: Chapter 1

Data and Information (cont.)• What is a field?

Combination of one or more characters Smallest unit of data user accesses

• Field size defines the maximum number of characters a field can contain

• Field name uniquely identifies each field• Data type specifies kind of data field contains

Matric No TextName TextDate Of Birth text

Students class file

Data types

Page 7: Chapter 1

Data and Information (cont.)• What are common data types?

Yes/NoYes/No(also called Boolean)

—only the values Yes or No (or True

or False)

HyperlinkHyperlinkWeb address that links to document or Web page

ObjectObjectalso called BLOB for binary large object)—photograph, audio, video,

or document created in other application such as word processing or spreadsheet

CurrencyCurrencydollar and cent amounts or

numbers containing decimal values

DateDatemonth, day, year, and

sometimes time

MemoMemolengthy text entries

TextText(also called

alphanumeric)—letters, numbers, or special

characters

NumericNumericnumbers

only

AutoNumberAutoNumberunique number automatically assigned to each new record

Page 8: Chapter 1

Data and Information (cont.)• What is a record?

Group of related fields

Key field, or primary key, uniquely identifies each record

Page 9: Chapter 1

Data and Information (cont.)• What is a data file?

Collection of related records stored on disk

fields

NO. PEND NAMA PELAJAR NO. HP PELAJAR NAMA SYARIKAT KOD SYARIKAT

10DAT09F1017 SOO HUI YING 0164697289 LIANG & CO P1531

10DAT09F1019 LAU XIN HUI 0124318638 TAN YEN WOOI & CO_01 P1532

10DAT09F1021 HONG CHING SHING 0164702233 THAM & CO P1533

10DAT09F1022 TAN IE VON 0166925719 CHUAHBOON CONSULTING SDN BHD P1534

Keyfield

records

Page 10: Chapter 1

Data and Information (cont.)• What is file maintenance?

Procedures that keep data current

Changing recordsAdding records

Deleting records

Page 11: Chapter 1

Data and Information (cont.)• Why do you add records?

Add new record when you obtain new data

• Why do you change records? Correct inaccurate data Update old data

• Why do you delete records? When record no longer is needed Some programs remove record immediately, others

flag record

Page 12: Chapter 1

Data and Information (cont.)• What is validation?

Process of comparing data with a set of rules to find out if data is correct

Reduce data entry errors and enhance data integrity before program writes data on disk

Page 13: Chapter 1

Data and Information (cont.)• What are the types of validity checks?

Consistency Check tests for logical relationship between two or more fields

Consistency Check tests for logical relationship between two or more fields

Range Check determines whether number is within specified range

Range Check determines whether number is within specified range

Completeness Checkverifies that a required field contains data

Completeness Checkverifies that a required field contains data

Check Digit number(s) or number(s) or character(s) character(s) appended to or appended to or inserted into a inserted into a primary key value primary key value to confirm to confirm accuracy of accuracy of primary key valueprimary key value

Check Digit number(s) or number(s) or character(s) character(s) appended to or appended to or inserted into a inserted into a primary key value primary key value to confirm to confirm accuracy of accuracy of primary key valueprimary key value

Alphabetic/Numeric Check ensures correct type of data entered

Alphabetic/Numeric Check ensures correct type of data entered

Page 14: Chapter 1

Add, change,

and delete data

Add, change,

and delete data

Createdatabase

Createdatabase

Sort and

retrieve data

Sort and

retrieve data

Createforms and

reports

Createforms and

reports

Data and Information (Cont.)• What is a database?

Database software allows you to

Database software allows you to

Collection of data organized so

you can access, retrieve, and

use it

Collection of data organized so

you can access, retrieve, and

use it

Database software also called database management system

(DBMS)

Database software also called database management system

(DBMS)

Page 15: Chapter 1

Purpose of Database Systems• What is a database?

Many programs and users can share data in database Secures data so only authorized users can access certain

data• What are the strengths of the database approach?

Reduced data redundancy

Reduced data redundancy

Improved data integrity

Improved data integrity

Shareddata

Shareddata

Easier accessEasier access

Reduced development

time

Reduced development

time

Page 16: Chapter 1

Purpose of Database Systems (cont.)• Drawbacks of using file systems to store data:

Data redundancy and inconsistency• Multiple file formats, duplication of information in different

filesDifficulty in accessing data

• Need to write a new program to carry out each new taskData isolation — multiple files and formats Integrity problems

• Integrity constraints (e.g. account balance > 0) become “buried” in program code rather than being stated explicitly

• Hard to add new constraints or change existing ones

Page 17: Chapter 1

Purpose of Database Systems (Cont.)• Drawbacks of using file systems to store data (cont.)

Atomicity of updates• Failures may leave database in an inconsistent state with partial

updates carried out• Example: Transfer of funds from one account to another should

either complete or not happen at allConcurrent access by multiple users

• Concurrent accessed needed for performance• Uncontrolled concurrent accesses can lead to inconsistencies

– Example: Two people reading a balance and updating it at the same time

Security problems• Hard to provide user access to some, but not all, data

• Database systems offer solutions to all the above problems

Page 18: Chapter 1

Database Management System (DBMS)

• DBMS contains information about a particular enterpriseCollection of interrelated dataSet of programs to access the dataAn environment that is both convenient and efficient to use

• Database Applications:Banking: all transactionsAirlines: reservations, schedulesUniversities: registration, gradesSales: customers, products, purchasesOnline retailers: order tracking, customized recommendationsManufacturing: production, inventory, orders, supply chainHuman resources: employee records, salaries, tax deductions

Page 19: Chapter 1

Database Management System (DBMS) (Cont.)

• Databases touch all aspects of our lives• DBMS used to maintain, query large datasets• Benefits include recovery from system crashes, concurrent

access, quick application development, data integrity and security

• Levels of abstraction give data independence• A DBMS typically has a layered architecture

Page 20: Chapter 1

Database Management System (DBMS) (Cont.)

• A typical DBMS has a layered architecture• The figure does not show the concurrency control and recovery

component• This is one of the several possible architectures. Each system has

its own variations

Query Optimization and Execution

Relational Operators

Files and Access Methods

Buffer Management

Disk Space Management

DB

These layers must consider concurrency control and recovery

Page 21: Chapter 1

Database Management System (DBMS) (Cont.)

• What are popular database management systems (DBMSs)?

Personal computer, midrange server, mainframe

IBM CorporationDB2

Personal computer, midrange server, mainframe

IBM CorporationInformix

ServerMicrosoft CorporationSQL Server

Personal computer, midrange server, PDA

Sybase Inc.Sybase

Personal computer, midrange server, mainframe, PDA

Oracle CorporationOracle

Personal computer, midrange server, mainframe

Computer Associates International, Inc.

Ingres

Personal computer, server, PDAMicrosoft CorporationAccess

Computer TypeManufacturerDatabase

Page 22: Chapter 1

Database Management System (DBMS) (Cont.)

• What are guidelines for developing a database?

3. Design the records and fields for each table

2. Design the tables

1. Determine the purpose of the database1. Determine the purpose of the database

4. Determine the relationships among the tables

4. Determine the relationships among the tables

Design tables on paper first Each table should contain

data about one subject Be sure every record has a unique

primary key Use separate fields for logically

distinct items Do not create fields for information

that can be derived from entries in other fields

Allow enough space for each field Set default values for frequently

entered data

Page 23: Chapter 1

End Of Chapter 1End Of Chapter 1