Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store...

42
Data & Databases Basic Data Fundamentals

Transcript of Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store...

Page 1: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data & Databases

Basic Data Fundamentals

Page 2: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data vs Information

Data: facts

Computer systems store data. Information: facts organized for a

specific application

Information is the output of a computer system

Page 3: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data

Atomic Data

Data in units that cannot be subdivided• First Name, Price, etc.

Binary Large Objects (BLOB)

Images and figures• Pictures, Cartoons

Objects

Data and associated processes• Spreadsheet tables, graphics components

Page 4: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Atomic Data

Most current systems store atomic data. Atomic data is typically made up of characters (letters and numbers) stored in coded groups of 8 bits called bytes.

ASCII American Standard Code for Information Interchange

EBCDIC Extended Binary Coded Decimal Interchange Code

Page 5: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Atomic Data

Because atomic variables aremade up of a relatively small number of codes, computers can interpret and manipulate them

Page 6: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Binary Large Objects

These are typically bit mapped pictures or images (such as FAXs) that are stored. Parts of these pictures have meaning (unlike atomic data). Digital pictures, video clips, stored images and signatures are BLOBs.

PIXEL blobs are usually stored as pixel codes that represent a point on a video screen

Page 7: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Bit Maps

1028

High Resolution

1028 x 640 = 657,920 pixelsBlack & White = 1 bit per pixel256 tone Color = 8 bits per pixel800

Page 8: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Image Processing

Images cannot be processed easily (other than displayed and scaled) by normal technology andusually require atttached atomicindexes. Text images can be con-verted although the software is notfully reliable.

Page 9: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Objects

Objects combine data and the processes that manipulate it. An example of an object is a spreadsheet table imported with the manipulation rules.

Encapsulation Formal Interface for Messages Inheritance

Page 10: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Object Processing

Object databases are new technologieswith immature design methodologies. They promise extensive code reuse andeasy system development if the tech-nology proves itself.

Page 11: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data, Metadata and Business Rules

Metadata is data about data, the structure descriptions of the stored files. Metadata includes location, format, field name, data description, etc.

Business rules include editing and processing rules as well as automatic procedures that must be processed for accurate data.

Page 12: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data Access Technology

Flat File structures.Data in one location; metadata and business rules in programs

Database Management SystemsData and metadata together; business rules in programs

Object Oriented systemsData, metadata and business rules together

Page 13: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Database Approach

Program 1

Program 2

Program 3

Meta-Data

Meta-Data

Meta-Data

Data

Program 1

Program 2

Program 3

Meta- Data

Data

FILE SYSTEM

DATABASE

Page 14: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Distribution Strategies for Databases

Centralized Data and Processing: Dumb terminal with "screen scraping".

Intelligent Terminal: Data and processing centralized; data preparation and display on remote devices.

Distributed Logic: Data storage distributed; processed at the optimal location. A version of parallel processing.

Client Server: Data (usually departmental) maintained on a server. Subsetting occurs on the server, processing on client machines.

Distributed Database: Data distributed among different locations; processing access data wherever it is located. Data may be replicated or partitioned.

Page 15: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Data Trends

Centralized and Client/Server systems Multi Layered architectures Objects and encapsulation Data driven organizations

Page 16: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Functions of a DBMSC.J. Date

Indexing Views Security Integrity Concurrency

Backup/Recovery Design Documentation Update/Query

Page 17: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Views

Custom representations of a database that correspond to the

needs of a class of users. Stored SELECT statements.

Page 18: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Views

Views Permit Maintaining a constant user interface Restricting access to specified

attributes Specifying user rights

Page 19: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Views3 Schema Architecture

PHYSICAL

CONCEPTUAL

LOGICALUser Views (Views or Queries)

Database administrators model for the data (E-R diagrams)

Actual data placement and structure (SQL statements)

Page 20: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Security

Components that limit access or actions to limit potential damage

to data.

Page 21: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Security Approaches

Views limit access and actions Authorization Rules identify users and

restrict actions User Defined Procedures in addition

to database security functions Encryption encode stored data Authentication positively identify users

Page 22: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Authorization Rules

Some DBMS products authorize actions based on specific records and functional descriptions. However, most DBMS’s limit actions on tables to one of:• Read: view but not change• Insert: read and add records• Update: read, insert and change records• Alter/Delete: read, insert, update and

delete records, change table structure

Page 23: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Authorization Rules

Subject Object Action Constraint

Sales Dept Cust Insert Credit < $5000

Program Ar4 Order Modify None

Terminal 12 Cust Modify Balance Due

Order Trans Cust Read None

Page 24: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Integrity

Components that preserve the relationship among different

related records in the database

Page 25: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Integrity

The relationship among records in the database

Referential Integrity Non Key Integrity Derived Conditions

Page 26: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Concurrency

Preventing two users from interfering with each other when they use the same information

Page 27: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Concurrency

LockoutRestricting access to users who could be

misled by partial transactions Versioning

Making trial updates on versions of the database and denying one if there is a data conflict.

Page 28: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Locks

MasterStudent Grade

00 Fred01 Anthony02 Steve03 Ivan

Program 1 locks record<exclusive>.

No other program canread the record.No program can havean active lock.

Program 2 locks record<shared>

Other programs can read, but not changerecord.No program can have an exclusive lock.

Page 29: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Versioning

Version 1

Time 1 Version 2

Time 2Version 3

Time 3

Commits version 3 only after changes to versions 1 and 2 have been rolled back.

Page 30: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Backup and Recovery

Processes to confirm and repeat transactions so that database

can be restored to a valid state after a problem.

Page 31: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Backup and Recovery

Backup Copies• Master• Transaction Log

Journalization• Forward Log• Backward Log

Checkpoints

Page 32: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

DBMS Logs

MasterStudent Grade

00 Fred01 Anthony02 Steve03 Ivan

TransactionInsert Li with grade AChange Fred’s grade to A

Page 33: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Recover from Backup

Slow May give different answers from original

BackupTransac-

tion+ = RecoveredDatabase

Page 34: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

DBMS Logs

MasterStudent Grade

00 Fred A01 Anthony02 Steve03 Li A

TransactionIns Li with grade AChg Fred’s grade to A

Backward LogStudent Grade

03 n/p00 Fred

Forward LogStudent Grade

03 Li A00 Fred A

Page 35: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

DBMS Logs

MasterStudent Grade

00 Fred A01 Anthony02 Steve03 Li A

TransactionIns Li with grade AChg Fred’s grade to A10:00 Checkpoint

Backward LogStudent Grade

03 n/p00 Fred

Chkpt

Forward LogStudent Grade

03 Li A00 Fred A

Chkpt

Page 36: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

DBMS Logs

MasterStudent Grade

00 Fred A01 Anthony02 Steve B03 Li A

TransactionIns Li with grade AChg Fred’s grade to A10:00 CheckpointChg Steve grade to B

Backward LogStudent Grade

03 n/p00 Fred

Chkpt02 Steve

Forward LogStudent Grade

03 Li A00 Fred A

Chkpt02 Steve B

Page 37: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Recover to Checkpoint Using Logs

ContaminatedDatabase

BackwardLog- Correct at

Checkpoint=

RecentTransactions+ Recovered

Database=

Page 38: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Transaction Processing

A set of computer operations required to process a single unit of work.

A transaction must conclude with the database in a valid state whether the transaction terminates correctly or abnormally

Page 39: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Transaction Boundaries

Set Boundary• Obtain Locks• Execute Code Modules• Evaluate Correctness

Commit or Rollback• Release Locks

Page 40: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Transaction BoundariesPremiere Products Example

SALESREP CUSTOMER

ORDER-PRODUCT

ORDER

PRODUCT

Place an order for a new customer with a 1500 credit limit

Page 41: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

Transaction BoundariesPremiere Products Example

SALESREP CUSTOMER

ORDER-PRODUCT

ORDER

PRODUCT

•Insert CUSTOMER Record•Update CUSTOMER with SALESREP Foreign Key•Insert ORDER Record•Insert ORDER-PRODUCT with Foreign Keys•Update ProductOnHand in PRODUCT•Check Credit Limit

Page 42: Data & Databases Basic Data Fundamentals. Data vs Information l Data: facts Computer systems store data. l Information: facts organized for a specific.

D A T A