Docsity

Understanding Data Files, Fields, and Keys in Databases: Concepts & Organization, Slides of Fundamentals of E-Commerce

Partial preview of the text

Download Understanding Data Files, Fields, and Keys in Databases: Concepts & Organization and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Databases

Lecture Objectives

• Database Concepts • Data Organization

in databases

• Key

Field

• Main activities in

Database Maintenance

– Defining data– Creating data– Manipulating data • Database

Usage

Data Organization in Databases Character

Character

Character Field

Record

Data File Cha.. Field

Cha.. Field……

Record :……….

A Database

Data File Data File ………..

Data Organization Example • In a University database

A^

L^

I

Field: Name

Record for Ali

File: Student 9 8 … Field: ID

(^7 0) Field: Score

Record for Rasheed Record for …

File: Course File: Faculty

UniversityDatabase

….Database Concepts

•^ Key Field^ – Searching a particular record uniquely in a data file

requires at least one field unique in value for all records – Example

, in STUDENT file StudentNumber is such a

field– Common

example of key values

(in daily life

databases)^ • Social Security Number• Driver’s License• Student ID Numbers

Electronic Databases

-^ Databases on some

electronic media like disks

-^ Computer programs are needed to

maintain/ use on disk

databases• Three main activities

for electronic database maintenance

-^ Defining^ •

Specifying the

data types

,^ data validation

rules etc. for the data values

-^ Creating^ •

Storing the data values (as defined by the user)

on some physical

medium

-^ Manipulating^ •

Querying/ searching/ updating the data values • Checking the conformance with the defined data constraints(validation rules)

Database

Implementation

Approaches

-^ Flat File Approach^ – Every data file is tried to be rich in all the relevant

details– Every data file is used on a localized basis (e.g. one filefor each department).– This makes every file independent of the other files inthe database – Benefit

: Data Reporting is easily done on each file

independently – Disadvantage

: Data inconsistencies may result due to

data redundancies (duplications)

A Flat File Database

A Student Grade Database^ •All the information needed is placed in one single data file•For example, a spreadsheet containing a single student grade file•No need to refer to any other file for data reporting Redundant data values

  • In GRADE_REPORT:•Student’s personal information includes:^ StudentNumber, StudentName, Class, Major •Whenever a grade record for a student is inserted in the file, hispersonal information is repeated.

GRADE_REPORT

StudentID

Name

Class^

Major^

CourseCode

SectionCode

Grade

17 Smith

1 CS^

MATH

1 B

17 Smith

1 CS^

CS

1 C

8 Brown^

2 COE^

MATH

2 A

8 Brown^

2 COE^

CS

1 A

8 Brown^

2 COE^

CS

1 B

8 Brown^

2 COE^

CS

1 A