Sie sind auf Seite 1von 31

Lecture Notes 1

Data Modeling

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

Database: A collection of related data. Data: Known facts that can be recorded and have an implicit meaning.
An integrated collection of more-or-less permanent data.

Mini-world: Some part of the real world about which data is stored in a database. For example, student grades and transcripts at a university. Database Management System (DBMS): A software package/ system to facilitate the creation and maintenance of a computerized database. Database System: The DBMS software together with the data itself. Sometimes, the applications are also included.
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 2

Evolution of Database System

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

Ways of storing data


Files ancient times (1960) Databases
Hierarchical (1970) Network (1970) Relational (1980) Object (1990)

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

File terms
Record data items related to a single logical entity (e.g. a students information) or row in a table Field a place for a data item in a record (first name field in a student record) or a column in a table File a sequence of records of the same type (the table)
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 5

File structures
A file: STUDENT
ID Last 3 1 record 2 4 Smith Wood Kent Boone field

First Jane Bob

Grade A C B B

Chuck Dan

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

File organization
Serial
new records appended

Sequential
records ordered in file, usually according to a numeric key

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

File structures
Serial
list of entries in which the order of entry into the list determines the order of the list
ID Last First Grade 3 Smith Jane A 1 2 4 Wood Kent Boone Bob Chuck Dan C B B

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

File structures
Sequential
list of entries ordered in some way (e.g. numerically or alphabetically)

ID Last 1 2 3 4 Wood Kent Smith Boone

First Grade Bob Chuck Jane Dan C B A B

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

Problems with files


Redundancy number of files grows with applications, and data is duplicated Inconsistency data is updated in one applications files, but not in anothers Maintenance problems changes to data structures mean changes to many programs Difficulty combining data business needs may mean users want data from different applications
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 10

Data Modeling
It is essential to building a good database. refers to the process where by data is structured and organized. Once data is structured, it is usually then implemented into what is called a database management system. The main idea behind these systems to manage vast amounts of both structured and unstructured data.
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 11

Unstructured data include documents, word processing, e-mail messages, pictures, and digital video and audio files. Structured data, what is needed to make a data model (via a data model theory), is found in management systems like relational databases.

Data Model
representations of different entity classes that a company wants to possess information about, containing the specifics behind that information, and the relationship among the differing entities and attributes.

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

12

Both the blueprint and the foundation A representation of reality, a way to graphically plot your data requirements A visual model of what your database can look like when you get it implemented. the hardest and most important activity in the RDBMS world. If you get the data model wrong, your application might not do what users need, it might be unreliable, it might fill up the database with garbage.

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

13

Phases of Data Modeling


1. Conceptual Design Phase
Describes the concept of the database Graphically represents the data and information needs of the business Represents what the database can do and will do, but not how it does it Will not show processes or activities related to the data Database designer uses an entity relationship diagram Vendor neutral and technology independent

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

14

Phases of Data Modeling


2. Logical Design Phase
You begin to convert or map the conceptual ERD to a more complete set of entities that begin to resemble tables. You also test to make sure the tables you designed are in third normal form or better, and you make decisions on record modification behavior Should also be technology and vendor independent
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 15

Phases of Data Modeling


3. Physical Design Phase
The logical model is converted to a specific product platform Technology dependent Sometimes designers combine the physical design phase with the physical implementation phase, the result brings a test database with a set of tables representing the database entities

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

16

Common Data Models


Hierarchical Network Relational Object

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

17

Hierarchical database model

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

18

Hierarchical data model


Parent-child relationship (one-to-one or one-to-many) among data
Grade Class

Student

Instructor

ID

Department

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

19

Hierarchical data model


Advantages
easy to search add new branches easily

Disadvantages
must establish the types of search prior to development of the hierarchical structure

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

20

Network data model

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

21

Network data model


One-to-one, one-to-many, many-to-one, or many-to-many relationships possible
Grade Class

Student

Instructor

ID

Department

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

22

Network data model


Advantages
flexible, fast, efficient

Disadvantages
Complex restructuring can be difficult because of changing all the pointers

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

23

Relational database model

Stores both
Data about real world objects (entities) in tables Relationships between the tables

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

24

Relational database
Fields (columns) in the table store attributes.
Each attribute has a specific domain.

Tuples (or records or rows) in the table store information.


Each tuple is a unique instance of an object.

Tables are composed of a set of tuples.


A table is also called a relation.

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

25

Terms
Table A collection of relevant data relating to one type of real world objects. Column A specific place for one type of data relating to one type of real world objects. Domain Set of all possible values for a specific column. Row Collection of data describing one real world object. Primary Key Columns, which are part of the row and uniquely identify any one row.
ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT 26

Records
Each record represents a logical entity (e.g. a student) Each field represents an attribute of the logical entity
Student StudID Last First Grade Section 1 Wood Bob C IST357 2 3 4 Kent Smith Boone Chuck Jane Dan B IST115 A IST357 B IST357
27

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

Keys
Each table has a primary key, one field (or a combination of fields) that has a unique value for each and every record in the table
Student StudID Last First Grade Section 1 Wood Bob C IST357 2 3 4 Kent Smith Boone Chuck Jane Dan B IST115 A IST357 B IST357

StudID is the primary key in this table (two students may share either a last or first name)

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

28

Relating tables
Tables can be related (joined) together based on their keys The idea is to decompose into separate tables with no redundancy and to provide a capability to reassemble with no information loss

Student
StudID Last First Grade Section

Class
Section #Stud Instructor

1 2 3 4

Wood Kent Smith Boone

Bob Chuck Jane Dan

C IST357 B IST115 A IST357 B IST357

IST357 IST115 IST20

48

Jones

120 Brower 120 Fountain

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

29

Relating tables
Primary key Foreign key Primary key

Student Class StudID Last 1 2 3 4 Wood Kent Smith Boone First Grade Section Bob Chuck Jane Dan C IST357 B IST115 A IST357 B IST357 Section IST357 IST115 IST20 #Stud Instructor 48 Jones 120 Brower 120 Mennis

ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

30

Relating tables
Student
StudID Last First Grade Section

Class
Section #Stud Instructor

1 2 3 4

Wood Kent Smith Boone

Bob Chuck Jane Dan

C IST357 B IST115 A IST357 B IST357

IST20

120 Brower

IST115 120 Jones IST357 48 Jones

Instructor Name Office Jones Brower


ADBMS Lecture Notes 1: Prepared by Engr. Cherryl D. Cordova, MSIT

332 517
31

Das könnte Ihnen auch gefallen