35
Nov 29 fit100-24-forms © 2006 University of Washington 1 The Information School of the University of Washington More Forms INFO/CSE 100, Fall 2006 Fluency in Information Technology http://courses.washington.edu/info100/

1 The Information School of the University of Washington Nov 29fit100-24-forms © 2006 University of Washington More Forms INFO/CSE 100, Fall 2006 Fluency

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Nov 29 fit100-24-forms © 2006 University of Washington 1

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton More Forms

INFO/CSE 100, Fall 2006

Fluency in Information Technology

http://courses.washington.edu/info100/

Nov 29 fit100-24-forms © 2006 University of Washington 2

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Due on Friday @ Start of Class

• Homework 4

• Also on Friday - we will go over midterm 2 and project 2b

Nov 29 fit100-24-forms © 2006 University of Washington 3

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Readings and References

• Reading» Fluency with Information Technology

• Chapter 16, Case Study in Database Design

• References» MS Access Help files

• keyword “form”

Books

Publishers

Authors

ISBN Title

Price

ID Phone

Name

ID Phone

Name

PublisherOf

1

WrittenBy∞ ∞

Recall the ERD (entity relationship diagram)from last class

Nov 29 fit100-24-forms © 2006 University of Washington 5

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Link one book with many authors?

• We DO want:» to link each book to one or more authors

• We DON'T want» to specify extra fields (author1, author2, author3,

…)• this is wasteful and limits the max number of authors

» to specify each book entry several times, naming a different author in each row• this duplicates all the other information about the book

Nov 29 fit100-24-forms © 2006 University of Washington 6

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Add a cross-reference table!

• Refine the design so that it includes another table that is a book-author cross reference» Each entity in the table is a single cross reference

• Attribute: ISBN

• Attribute: Author ID

» Primary key becomes both Foreign keys combined

• Now we can break the many-to-many relationship into two 1-to-many relationships that we already know how to implement

Nov 29 fit100-24-forms © 2006 University of Washington 7

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Define new cross-reference entities

Books Authors

ISBN Title

Price

ID Phone

Name

∞ ∞Book/Author

ISBN AuthorID

1 1

Nov 29 fit100-24-forms © 2006 University of Washington 8

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

book-author table

Nov 29 fit100-24-forms © 2006 University of Washington 9

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Define the new relationships

Define a query that uses the relationship

Query By Example

actual SQL

Nov 29 fit100-24-forms © 2006 University of Washington 11

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Get the new view of the data

• Notice that this view has redundant data» That's okay, because we are not storing it this way, just presenting

it

» The redundant items (Alex, Another Press) came from a single entry in a table – they are guaranteed to be identical

Books

Publishers

Authors

ISBN Title

Price

ID Phone

Name

ID Phone

Name

PublisherOf

1

WrittenBy∞ ∞

Now we've implemented this entire schema.

View: All Books from “Another Press”

Nov 29 fit100-24-forms © 2006 University of Washington 14

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

View: All Books by Alex

View: All info about a given ISBN

Nov 29 fit100-24-forms © 2006 University of Washington 16

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Views as Tables

• Recall that the result of a query is a table

• We have been presenting the table to the user in simple tabular form

Nov 29 fit100-24-forms © 2006 University of Washington 17

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

But tables are not pretty …

Users need help understanding what they are looking at and what they can do with it

Nov 29 fit100-24-forms © 2006 University of Washington 18

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Front end and Back end

• Front end» We present the data to the user with some sort

of Graphical User Interface• Simple tabular display as we have been doing• MS Access provides Forms and Reports for GUIs• Web pages

• Back end» The database stores the data in tables» We use queries to construct new "virtual"

tables or views

Nov 29 fit100-24-forms © 2006 University of Washington 19

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

tonForms

A form is primarily used to enter or display data in a database

The designer controls what it looks like and how it works, so it can be tailored to specific needs

Nov 29 fit100-24-forms © 2006 University of Washington 20

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

A Form is just a Face for a table

• The form lets the designer arrange the data, label it, provide some control over events, etc» the presentation

» multiple presentations are possible depending on the specific needs of each user

• Underlying data comes from a table or a query» the content

» single source of data ensures consistency

Nov 29 fit100-24-forms © 2006 University of Washington 21

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

How does a form get built?

The Form wizard can help get you started.

But you probably want to tweak it …

Design

Nov 29 fit100-24-forms © 2006 University of Washington 23

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

But forms are not very compact …

Users like to have reports densely packed with information and logically arranged …

Nov 29 fit100-24-forms © 2006 University of Washington 24

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

tonReports

• A Report is another face for a table (or query)

• The report lets the designer arrange the data, label it, provide some control over events, etc» the presentation

» multiple presentations are possible depending on the specific needs of each user

• Underlying data comes from a table or a query» the content

» single source of data ensures consistency

Nov 29 fit100-24-forms © 2006 University of Washington 25

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

How does a report get built?

The New Report wizard can build a complete report for you.

Nov 29 fit100-24-forms © 2006 University of Washington 26

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

But this wizard is kind of naïve …

You might want to use the Report Wizard instead since it gives you more control.

Better looking report, but you still probably want to tweak it …

But you probably want to tweak it …

Nov 29 fit100-24-forms © 2006 University of Washington 31

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Explore the Design capabilities

• Properties of the various controls can be set• Controls and labels can be moved around• Images and patterns can be applied• Totals, averages, subtotals etc can be

calculated• Information can be grouped by selected

fields• Etc, etc – there is a lot of flexibility in how

these reports get generated

Nov 29 fit100-24-forms © 2006 University of Washington 32

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Questions

• Suppose I wanted a database to run a wine review web site.

» What would some entities be?

» What would some attributes be of those entities?

Nov 29 fit100-24-forms © 2006 University of Washington 33

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Questions

• In our wine review web site, what would the relationship be between a particular bottle of wine and the wine maker?» 1 to 0

» 1 to 1

» 1 to many

» many to many

Nov 29 fit100-24-forms © 2006 University of Washington 34

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Questions

• If we had two tables: WINE and WINE_MAKER and the schema looked like this:» WINE: wine_id, wine_name, wine_type

» WINE_MAKER: maker_id, maker_name, city, phone

Which table will take which primary key as a foreign key to build this relationship?

Remember the relationship is:1 WINE_MAKER to many WINE

Nov 29 fit100-24-forms © 2006 University of Washington 35

Th

e I

nfo

rmati

on

Sch

ool

of

the U

niv

ers

ity o

f W

ash

ing

ton

Questions

• Can I create two different forms that update the same information? Explain why this is/is not possible.