Top Banner
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts
34

BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Jan 18, 2016

Download

Documents

Stewart Thomas
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

BSA206 Database Management Systems

Lecture 2: Introduction to Oracle / Overview of Database Concepts

Page 2: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 2

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Chapter Objectives

Identify the purpose of a database management system (DBMS)

Distinguish a field from a record and a column from a row

Identify the basic components of an Entity-Relationship Model

Define the three types of relationships that can exist between entities

Page 3: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 3

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Chapter Objectives

Identify the problem associated with many-to-many relationships and the appropriate solutions

Explain the purpose of normalization Describe the role of a primary key Identify partial dependency and

transitive dependency in the normalization process

Page 4: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 4

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Chapter Objectives

Explain the purpose of a foreign key Determine how to link data in different

tables through the use of a common field

Explain the purpose of a structured query language (SQL)

Page 5: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 5

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Terminology

Database – logical structure to store data

Database Management System (DBMS) – software used to create and interact with the database

Page 6: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 6

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Components

Character Field Record File

Page 7: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 7

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Components - Character

Basic unit of data Can be a letter, number, or special

symbol

Page 8: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 8

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Components - Field

A group of related characters Represents an attribute or

characteristic of an entity Corresponds to a column in the

physical database

Page 9: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 9

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Components - Record

A collection of fields for one specific entity

Corresponds to a row in the physical database

Page 10: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 10

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Database Components - File

A group of records about the same type of entity

Page 11: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 11

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Components Example

Page 12: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 12

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Review of Database Design

Systems Development Life Cycle (SDLC)

Entity-Relationship Model (E-R Model)

Normalization

Page 13: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 13

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Systems Development Life Cycle (SDLC)

Systems investigation – understanding the problem

Systems analysis – understanding the solution

Systems design – creating the logical and physical components

Page 14: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 14

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Systems Development Life Cycle (SDLC)

Systems implementation – placing completed system into operation

Systems maintenance and review – evaluating the implemented system

Page 15: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 15

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Entity-Relationship Model (E-R Model)

Used to depict the relationship that exists among entities

Page 16: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 16

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

E-R Model Symbols

Page 17: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 17

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Relationships

The following relationships can be included in an E-R Model:– One-to-one

– One-to-many

– Many-to-many

Page 18: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 18

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

One-to-one Relationship

Each occurrence of data in one entity is represented by only one occurrence of data in the other entity

Example: Each individual has just one Social Security Number (SSN) and each SSN is assigned to just one person

Page 19: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 19

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

One-to-many Relationship

Each occurrence of data in one entity can be represented by many occurrences of the data in the other entity

Example: A class has only one instructor, but each instructor can teach many classes

Page 20: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 20

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Many-to-many Relationship

Data can have multiple occurrences in both entities

Example: A student can take many classes and each class is composed of many students

Can not be included in the physical database

Page 21: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 21

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Example E-R Model

Page 22: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 22

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Normalization

Determines required tables and columns for each table

Multi-step process Used to reduce or control data

redundancy

Page 23: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 23

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Unnormalized Data

Contains repeating groups in the Author column in the BOOKS table

Page 24: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 24

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

First-Normal Form (1NF)

Primary key is identified Repeating groups are eliminated

Page 25: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 25

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

First-Normal Form (1NF)

ISBN and Author columns together create a composite primary key

Page 26: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 26

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Composite Primary Key

More than one column is required to uniquely identify a row

Can lead to partial dependency - a column is only dependent on a portion of the primary key

Page 27: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 27

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Second-Normal Form (2NF)

Partial dependency must be eliminated– Break the composite primary key

into two parts, each part representing a separate table

Page 28: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 28

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Second-Normal Form (2NF)

BOOKS table in 2NF

Page 29: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 29

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Third-Normal Form (3NF)

Publisher contact name has been removed

Page 30: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 30

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Summary of Normalization Steps

1NF: eliminate repeating groups, identify primary key

2NF: table is in 1NF and partial dependencies eliminated

3NF: table is in 2NF and transitive dependencies eliminated

Page 31: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 31

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Linking Tables

Once tables are normalized, make certain tables are linked

Tables are linked through a common field

A common field is usually a primary key in one table and a foreign key in the other table

Page 32: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 32

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Page 33: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 33

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

JustLee Books’ Database

Assumptions– No back orders or partial shipments– Only USA addresses– Shipped orders are purged (deleted) at

the end of the month

Page 34: BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.

Lecture 2 / Slide 34

Introduction to Oracle9i: SQL, Morris-Murphy ©2003

Structured Query Language (SQL)

Data sublanguage Used to:

– Create or modify tables– Add data to tables– Edit data in tables– Retrieve data from tables