xp class objectives – 9/10 and 9/12 learn how to design a small database understand the goals of a...

19
XP XP XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design Learn how to read a database design diagram Know how to create a database design diagram Implement a small custom database in MS Access Take a database design diagram and implement the resulting database in MS Access Create tables Create attributes with correct data types Create relationships and referential integrity constraints 1

Upload: ellen-higgins

Post on 27-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPClass Objectives – 9/10 and 9/12

• Learn how to design a small database Understand the goals of a database Understand the terminology of database design Learn how to read a database design diagram Know how to create a database design diagram

• Implement a small custom database in MS Access Take a database design diagram and implement the

resulting database in MS Access Create tables Create attributes with correct data types Create relationships and referential integrity constraints

1

Page 2: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPHelp available

• Your books!!!!• Online help via Access and Excel• Google (or other favorite search engine)• Teaching Assistant (Robert Dittmer)

Office hours: Monday andWednesday 10AM-noon Email: [email protected]

• Professor (Dana Edberg) Office hours: TR 1:15-2:15PM, 4-5PM Email: [email protected]

2

Page 3: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPQuestions for a systems developer

• What am I trying to accomplish by using a computer? Are you: Keeping track of lots of information for organization, customer,

government, investor? Making processes more efficient requiring less labor? Facilitating decision making? Presenting information in a more readable, attractive format?

• What is the best way to accomplish your goals? Database management system? Spreadsheet? Web front end? Custom developed programs? Combination?

3

Page 4: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPBook Example: Belmont Landscapes

Company provides landscape architecture services including analyzing sites, developing plans and performing construction work.

Wants to have a way to keep track of the work that will be done for customers (“contracts”) and then have a way to charge those customers (“invoices”) once the work has been completed.

4

Page 5: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Spreadsheet or Database for Belmont Landscapes?

5

Decision Issue

Spreadsheet (Excel)

Database (Access)

Ability to maintain accurate data

Limited. Completely dependent on user for accurate input.

Excellent. Many filters/constraints available to protect data accuracy.

Ease of showing data in different formats

Limited. Can make small color changes to basic spreadsheet.

Excellent. Very flexible. Data entered once can be viewed in many different formats.

Ease of doing calculations

Excellent. Statistics, financial functions available.

Limited. Can do calculations, but only basic math.

Difficulty of learning/using product

Excellent. Easy to learn. Difficult to learn.

Necessity for pre-planning

Not much planning required.

Must plan/design the database in advance.

Page 6: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPWhy do we store data in a database?

• To protect the “integrity” of the data. Make data accurate. Reduce data redundancy.

• To make data more accessible. Enhance flexibility of data access methods. Improve speed of data access.

• To make an application more adaptable. Provide more flexibility in application development. Decrease dependence on a given visualization method.

6

Page 7: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Examine the contract “spreadsheet”

• Review data content.• What is the application? What is the purpose of the

stored data?• Is any of the data redundant? • Why might redundant data be a problem?

7

Page 8: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

8

Page 9: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPVocabulary lesson - 1

• Table: A two-dimensional database object used to store data.

• Row: One “entry” of data within the table. Must have a primary key that has a different value than all other rows of data within the table

• Column: A field used to store data. Must have a single data type.

• Cell: An intersection of a row and column. Can only have one data type and one value.

9

Page 10: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPVocabulary lesson - 2

• Entity (when implemented it is called a “table”): A person, place, or thing about which we store data. Example is a Customer for Belmont Landscapes.

• Entity instance(also called a “record” or “row”): One instance of an entity that includes all data stored about that instance. Example is “Anthony Rodriquez” for Belmont.

• Attribute (also called a “field” or “column”): A characteristic of the entity about which we store data. Examples are Company, FirstName, Lastname for a Customer entity.

10

Page 11: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPProcess for Designing Databases

• Identify all the fields needed to produce the required information Divide each piece of data into its smallest useful part

Example 1: Break up a name into first, last, initial

Example 2: Break up an address into street, city, state, zip

• Group related fields into tables. Start with the “strong” tables.

• Use an entity-relationship diagram (ERD) to depict the design

• Determine each table’s primary key

• Identify how the tables are related (or if they are related) Include a common field in related tables (foreign key)

• Determine the properties of each field Type of data: Text, date, number, etc.

Size of data

Name of data11

Page 12: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Contract Data

12

Page 13: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Group (sub-divide) the customer data

13

Page 14: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Group (sub-divide) the invoice data

14

Page 15: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPWhat is a primary key?

• Definition• Examples• “Natural” vs. “Surrogate”

15

Page 16: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

Define keys and relationships

16

Page 17: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

What does it look like in Access?

17

Page 18: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPWhat is a foreign key?

• Definition• Example• Depiction on diagrams

18

Page 19: XP Class Objectives – 9/10 and 9/12 Learn how to design a small database Understand the goals of a database Understand the terminology of database design

XPXPXPWhat is referential integrity?

• Definition: A constraint to enforce consistency between parent and child tables in a database.

• “Constraint”: A limit; a set of pre-defined rules.• Conceptual example: Contract and customer.• Implementation in Access example

Create after a table has been created through the relationship diagram.

Create while the table is being created through the use of a Lookup wizard.

19