Download omis350-Appendix-C

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Predictive analytics wikipedia , lookup

Operational transformation wikipedia , lookup

Expense and cost recovery system (ECRS) wikipedia , lookup

Concurrency control wikipedia , lookup

Data analysis wikipedia , lookup

Versant Object Database wikipedia , lookup

3D optical data storage wikipedia , lookup

Information privacy law wikipedia , lookup

Business intelligence wikipedia , lookup

Database wikipedia , lookup

Data model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Open data in the United Kingdom wikipedia , lookup

Clusterpoint wikipedia , lookup

Data vault modeling wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
APPENDIX C
DESIGNING
DATABASES
McGraw-Hill/Irwin
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved.
C-2
INTRODUCTION
 The core chapters introduced:
• Database - maintains information about various types
of objects (inventory), events (transactions), people
(employees), and places (warehouses)
• Database management system (DBMS) – creates,
reads, updates, and deletes data in a database while
controlling access and security
• Relational database model - a type of database that
stores its information in the form of logically-related
two-dimensional tables
C-3
ENTITIES AND DATA
RELATIONSHIPS
 Data model – The logical data structures that detail the
relationships among data elements using graphics or
pictures
 The underlying relationships in a database environment
are:
• Independent of the data model
• Independent of the DBMS that is being used
 Entity-relationship diagram (ERD) - A technique for
documenting the relationships between entities in a
database environment
C-4
ENTITIES AND THEIR ATTRIBUTES
 Entity - Also called a table, stores information
about a person, place, thing, transaction, or
event
• A customer is an entity, as is a merchandise item
 Attribute – Data elements associated with an
entity
A CUSTOMER entity can be described by a Customer
Number, First Name, Last Name, Street, City, State, Zip
Code, Phone Number
C-5
ATTRIBUTES
 There are several types of attributes
including:
• Simple versus composite
• Single-valued versus multi-valued
• Stored versus derived
• Null-valued
C-6
DOCUMENTING ENTITYRELATIONSHIP DIAGRAMS
 The two most commonly used styles of
ERD notation are:
1. Chen
2. Information Engineering
 The Chen model uses rectangles to
represent entities
• Each entity's name appears in the rectangle
and is expressed in the singular, as in
CUSTOMER
• Attributes are expressed in ovals
C-7
BASIC DATA RELATIONSHIPS
 Once the basic entities and attributes
have been defined, the next task is to
identify the relationships among entities
 There are three basic types of
relationships:
1. One-to-one
2. One-to-many
3. Many-to-many
C-8
DEALING WITH MANY-TO-MANY
RELATIONSHIPS
 There are problems with many-to-many
relationships
1. The relational data model cannot handle
many-to-many relationships directly
– It is limited to one-to-one and one-to-many
relationships
– Many-to-many relationships need to be replaced
with a collection of one-to-many relationships
2. Relationships cannot have attributes
– An entity must represent the relationship
C-9
RELATIONAL DATA MODEL AND
THE DATABASE
 Once the ERD is completed, it can be
translated from a conceptual logical
schema into the formal data model
required by the DBMS
 Most database installations are based on
the relational data model
 The relational data model is the result of
the work of one person, Edgar (E. F.)
Codd
C-10
FROM ENTITIES TO TABLES
 The word “table” is used synonymously
with “entity”
 The definition specifies what will be
contained in each column of the table, but
does not include data
C-11
FROM ENTITIES TO TABLES
 When rows of data are included, an
instance of a relation is created
C-12
FROM ENTITIES TO TABLES
 A row in a relation has the following
properties:
• Only one value at the intersection of a column
and row - a relation does not allow multivalued attributes
• Uniqueness - there are no duplicate rows in a
relation
• Primary key - A field (or group of fields) that
uniquely identifies a given entity in a table
C-13
FROM ENTITIES TO TABLES
 A unique primary key makes it possible to
uniquely identify every row in a table
 The primary key is important to define to be able
to retrieve every single piece of data put into a
database
 There are only three pieces of information to
retrieve for any specific bit of data:
1. The name of the table
2. The name of the column
3. The primary key of the row
C-14
LOGICALLY RELATING TABLES
 The use of
identifiers
represent
relationships
between
entities
C-15
LOGICALLY RELATING TABLES
 When a table contains a column that is the
same as the primary key of a table, the column
is called a foreign key
 Foreign key - A primary key of one table that
appears as an attribute in another file and acts
to provide a logical relationship between the two
files
 Example:
• CUSTOMER(Customer Number, First Name, Last Name,
Phone Number)
• ORDER(Order Number, Customer Number, Order Date)