Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.

Similar presentations


Presentation on theme: "Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES."— Presentation transcript:

1 Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES

2 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

3 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

4 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

5 C-5 ATTRIBUTES  There are several types of attributes including: Simple versus composite Single-valued versus multi-valued Stored versus derived Null-valued

6 C-6 DOCUMENTING ENTITY- RELATIONSHIP 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

7 C-7  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 BASIC DATA RELATIONSHIPS

8 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

9 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

10 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

11 C-11 FROM ENTITIES TO TABLES  When rows of data are included, an instance of a relation is created

12 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 multi- valued 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

13 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

14 C-14 LOGICALLY RELATING TABLES  The use of identifiers represent relationships between entities

15 C-15  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) LOGICALLY RELATING TABLES


Download ppt "Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES."

Similar presentations


Ads by Google