Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design. Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements.

Similar presentations


Presentation on theme: "Database Design. Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements."— Presentation transcript:

1 Database Design

2 Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements Application 3

3 Database Design Process (called “Normalization”) Process of organizing data in a database Process of organizing data in a database –This includes creating tables and establishing relationships between those tables according to rules designed both to protect the data and to make the database more flexible by eliminating redundancy and inconsistent dependency. Eliminates “redundant” data Eliminates “redundant” data –Redundant data wastes disk space and creates maintenance problems. –If data that exists in more than one place must be changed, the data must be changed in exactly the same way in all locations. A customer address change is much easier to implement if that data is stored only in the Customers table and nowhere else in the database.

4 Entity  Table An Entity is an object in the real world (or even imaginary worlds) about which we want or need to maintain information An Entity is an object in the real world (or even imaginary worlds) about which we want or need to maintain information –Persons (e.g.: customers in a business, employees, authors) –Things (e.g.: purchase orders, meetings, parts, companies)

5 Example: Course Registration System Draw Entities Instructor Course Student

6 Attributes  Fields Attributes are the significant properties or characteristics of an entity that help identify it and provide the information needed to interact with it or use it. Attributes are the significant properties or characteristics of an entity that help identify it and provide the information needed to interact with it or use it.

7 Example: Course Registration System Add Attributes Instructor Name Course Student Office Loc Phone Dept Title Level Name Address Birthdate

8 “ Special ” Attribute: Primary Key (PK) PK’s are Field(s) that uniquely identify a record PK’s are Field(s) that uniquely identify a record –Example: CourseNo & InstructorID PK can be: PK can be: –A single field (e.g., UserID), or –Multi-field—i.e., “composite” (OrderNo, LineItem)

9 Example: Course Registration System Add PK’s (underline/separate with a line) Instructor Name Course Student Office Loc Phone Dept Title Level Name Address Birthdate InstructorID CourseNo StudentID

10 Time for Hands-On Photo © Charles Darwin University 2005

11 Find Entities, Attributes, and PKs Placeholder

12 Relationships Relationships are the associations between entities. They can involve one or more entities and belong to particular relationship types Relationships are the associations between entities. They can involve one or more entities and belong to particular relationship types Types of Relationships 1:1 Relationship 1:1 Relationship 1:M Relationship 1:M Relationship M:M Relationship M:M Relationship

13 Instructor PKInstructorID Course PK CourseNo Teaches Relationships

14 Instructor PKInstructorID Course PK CourseNo Teaches “Cardinality” 1 M

15 Student PKStudentID Course PK CourseNo Taken By “Cardinality” M M

16 Many-to-Many Relationships Not good for database design  Need to “convert” every Many-to-Many relationship into 2 One-to-Many relationships with a third table called “Intersection Table”

17 Student PKStudentID Course PK CourseNo Taken By M M Resolving Many-to-Many

18 Student PKStudentID Course PK CourseNo Resolving Many-to-Many Enrollment PK CourseNo PK StudentID

19 A field in a table that is a PK in another table Foreign Key (FK)

20 Student PKStudentID Course PK CourseNo Enrollment PK, FK CourseNo PK, FK StudentID Instructor PK InstructorNo FK Example: Course Registration System Foreign Keys (FK)

21 Time for Hands-On Photo © Charles Darwin University 2005

22 Draw Relationships

23 http://itec601.wikidot.com


Download ppt "Database Design. Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements."

Similar presentations


Ads by Google