Presentation is loading. Please wait.

Presentation is loading. Please wait.

WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Primary Keys Table Instance Charts.

Similar presentations


Presentation on theme: "WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Primary Keys Table Instance Charts."— Presentation transcript:

1 WEEK 10 Database Design

2 Agenda – Week 10 Review Hybrid Review Primary Keys Table Instance Charts

3 Review Entities are…. Attributes are…. Primary key is….. Foreign key is …… Information is accessed according to its structure, not its location Use keys to identify relationships

4 Review Solution to Hybrid Homework

5 RELATIONSHIPS

6 Three Basic Types of Relationships One to One (1:1) One to Many (1:M) Many to Many (M:M)

7 One to One Relationships 1:1 relationships exists when a single record in one table has 1 and only 1 corresponding record in another table, and vice versa

8 One to One Example A voter can cast only one vote in an election. A ballot paper can belong to only one voter. So there will be a 1:1 relationship between a Voter and a Ballot Paper. Voter Ballot

9 One to Many Relationships Most common 1:m or m:1 Relationship exists when a record can relate to 1 or more records in a second table but.. A record in the 2 nd table can only relate to 1 record in the first table

10 One to Many Example A person can own more than one car. A car can only have one owner. OwnerVehicle

11 Many to Many Relationships M:M Relationship exists when a record in either table can relate to more than one record in the other table

12 Many to Many Example A student can have more than one professor; the same professor can have many students StudentProfessor

13 Resolving Many to Many M:M is not allowed We create a junction or joiner entity The name of the joiner entity is often a combination of the 2 entities StudentProfessorStud_Prof

14 Exercise: ERD & Relationships Draw an ERD for the puzzle ◦ Describe the relationships using the following format Source Entity Destination Table Relationship Type Describe the relationship in your own words CustomerMovie Rental customer MovieMovie Rental Movie

15 Exercise: ERD & Relationships ◦ Describe the relationships in the curling bonspiel Source Entity Destination Table Relationship Type Describe the relationship in your own words

16 Review Relationship Essentials Need a primary key Need a foreign key ◦ A foreign key is a column in a table used to reference a primary key in another table. Not all tables will require a foreign key Primary key and foreign keys are essential when you create relationships that join together multiple tables in a database

17 Scenarios Political Canvassing Human Resource Dept. Private Elementary School Yoga Studio *** note each database should be around 5 tables

18 TYPES OF DATA

19 Common Data Types in Access Autonumber Text Memo Number Currency Date/Time Yes/No

20 Autonumber Use for unique sequential numbering Commonly used for PK Increments by 1 Automatically inserted when a record is added.

21 Text Used for text or combinations of text and numbers, such as addresses, or for numbers that do not require calculations, such as phone numbers, part numbers, or postal codes. Stores up to 255 characters.

22 Memo Use for lengthy text and numbers, such as notes or descriptions. Should be used sparingly Stores up to 65,536 characters (if not more)

23 Number Use for data to be included in mathematical calculations, except calculations involving money (use Currency type).

24 Yes/No Use for data that can be only one of two possible values, such as ◦ Yes/No, ◦ True/False, ◦ On/Off. Null values are not allowed

25 TABLE INSTANCE CHARTS

26 Table Instance Chart Sample One chart completed for each table ◦ Wk10_TableInstanceChart.xlsx Wk10_TableInstanceChart.xlsx

27 Exercise Create table instance chart for: ◦ the puzzle (together)

28 Exercise Create table instance chart for: ◦ Curling Bonspiel scenario

29 Access DB Create a database Create tables Build relationships Populate tables

30 Hybrid / Homework Hybrid: Refer to the 14 Week schedule Database Assignment Part 1

31 Quiz Time


Download ppt "WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Primary Keys Table Instance Charts."

Similar presentations


Ads by Google