lesson 32: designing a relational database

21
Lesson 32: Designing a Relational Database

Upload: xenos

Post on 24-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Lesson 32: Designing a Relational Database. Lesson Objectives. After studying this lesson, you will be able to: Identify and apply principles for good relational database design Modify field settings and create Lookup fields that return multiple values Create a split form - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lesson  32:  Designing a Relational Database

Lesson 32: Designing a Relational Database

Page 2: Lesson  32:  Designing a Relational Database

2

Lesson Objectives After studying this lesson, you will be able to:

Identify and apply principles for good relational database design

Modify field settings and create Lookup fields that return multiple values

Create a split form Identify database relationship types and create and

print a relationships report Identify object dependencies

Page 3: Lesson  32:  Designing a Relational Database

3

Principles of Good Database Design Reduce redundancy

Divide data into subject-based tables

Show Access how data in all tables related to scope (purpose) of the database

Ensure that data is complete and accurate

Include report formats, forms, and queries to process data and report information that meets the intended needs of the database

Tip! Incomplete/inaccurate data results in inaccurate processing and reporting, and invalidates the integrity of the database.

Page 4: Lesson  32:  Designing a Relational Database

Applying Design Steps

4

Design Step/Task Result

Identify the purpose of the database To generate a utility bill

Locate and organize detailed information about what the database should contain

Customer name, address, amount of power used, associated costs, company info

Separate the details into related groups Customer details, billing history, cost of power, utility company details

Identify additional breakdowns in information details

Customer first name, last name, street, city, state, zip code, telephone, etc.

Specify a primary key for each group of data Customer number

Relate tables to each other by identifying how data in one table can be connected to data in other tables

Customer number added to other tables to connect the tables

Create the database in Access and test the design

Create tables to determine whether or not you can generate the billing statement

Apply normalization rules and make necessary adjustments

Review the design using normalization levels (described elsewhere) and determine normalization level attained

Page 5: Lesson  32:  Designing a Relational Database

Normalizing Data Process of refining tables, keys, fields, and

relationships to create an efficient database Includes:

Discarding repeating groups Minimizing redundancy Eliminating composite keys for partial dependency Separating non-key attributes

Follows steps and guidelines for designing a database

5

Page 6: Lesson  32:  Designing a Relational Database

Common Field Properties

6

Property Description

Field Size Controls the number of characters Access allows in the field

Input Mask Sets the appearance of field data entered, adds standard characters such as parentheses, slashes and hyphens to the data, formats all data in caps or lowercase, etc.

Caption Displays alternate text in place of the field name in datasheets, on forms, and in reports; caption text is usually more descriptive, especially when field names are cryptic

Default Value Sets a data value that Access enters for a field when no other data is entered

Validation Rule Sets rules for data entered in a field so Access can check the data to ensure it meets value limitations

Validation Text Provides instructional information to help data entry personnel correctly enter data for a field with a validation rule; Access alerts user if invalid data is entered

Required Sets the field as a required field so data must be entered into that field

Page 7: Lesson  32:  Designing a Relational Database

Number Field Size Property Details

7

Field Size Description

Byte Stores whole numbers between 0 and 255 using 1 byte; allows no fractions or decimal points

Integer Stores whole numbers between -32,768 and 32,767 using 2 bytes rather than the 7 bytes used for high values

Long Integer Stores whole numbers between -2,147,483,648 and 2,147,483,647 using 4 bytes rather than the 14 bytes normally used for high values

Single Stores positive and negative numbers to exactly 7 decimal places using 4 bytes

Double Stores positive and negative numbers to exactly 15 decimal places using 8 bytes

Replication ID Identifies replication of tables, records, and other objects in Access 2003 or earlier databases using 16 bytes

Decimal Stores positive and negative numbers to exactly 28 decimal places using 121 bytes

Page 8: Lesson  32:  Designing a Relational Database

Multi-Value Lookups Enables you to select

multiple values for a field For example, you

might want to identify multiple vendors that supply products

8

Page 9: Lesson  32:  Designing a Relational Database

Split Forms

9

Displays form view at the top of the window and datasheet view at the bottom of the window.

Page 10: Lesson  32:  Designing a Relational Database

Working with Relationships Three types of relationships:

One-to-One One-to-Many Many-to-Many

10

Page 11: Lesson  32:  Designing a Relational Database

One-to-One Relationship Each record in Table A can have only one matching

record in Table B Example: Each employee’s address is stored in one

table and has a matching record in the payroll table

11

Page 12: Lesson  32:  Designing a Relational Database

One-to-Many RelationshipsEach record in Table A can have many

matching records in Table B Example: Each supplier in the Suppliers table could

have multiple items in the Inventory table

12

Page 13: Lesson  32:  Designing a Relational Database

Many-to-Many Relationships

13

Records in Table A can have many matching records in Table B, and vice-versa

Normally requires a Junction Table

Example: Items could be ordered by many customers and each customer might order many items

Page 14: Lesson  32:  Designing a Relational Database

Relationship Join Line Connects fields common to both tables

14

Page 15: Lesson  32:  Designing a Relational Database

Referential Integrity Sorting query results A system of rules used to

ensure that relationships are valid

Must be set in Edit Relationships dialog box

Access identifies the many and one side of the relationship

15

Page 16: Lesson  32:  Designing a Relational Database

16

Cascade Options Set in the Edit Relationships dialog box Cascade Update updates key field of a related table

when edits are made to field in primary table Cascade Delete removes records from a related table

when record is deleted from primary table

Page 17: Lesson  32:  Designing a Relational Database

17

Relationship Join Properties Join Properties: Control circumstances under which

a record from a related table appears when you run a query

Inner Joins: Check for records with matching values in the join field and displays only those that match

Left Outer Joins: Display all records from the one side of a one-to-many relationship

Right Outer Joins: Display all records from the many side of a one-to-many relationship

Page 18: Lesson  32:  Designing a Relational Database

Join Properties Dialog Box

Left table name: One side of one-to-many relationship

Right table name: Many side of one-to-many relationship

Join types and descriptions

Page 19: Lesson  32:  Designing a Relational Database

One vs. Many Sides of RelationshipsOne (left) side of relationship

Many (right) side of relationship

Join Type button

Page 20: Lesson  32:  Designing a Relational Database

Object Dependencies Shows the object for which

dependencies are shown at the top

You can choose to identify object dependent on the active object or those on which the object depends

Objects are listed by type

Page 21: Lesson  32:  Designing a Relational Database

Lesson 32: Designing a Relational Database