Presentation is loading. Please wait.

Presentation is loading. Please wait.

What's a Database A Database Primer Let’s discuss databases n Why they are hard n Why we need them.

Similar presentations


Presentation on theme: "What's a Database A Database Primer Let’s discuss databases n Why they are hard n Why we need them."— Presentation transcript:

1

2 What's a Database A Database Primer

3 Let’s discuss databases n Why they are hard n Why we need them

4 Advantages of Database Processing n More information from the same amount of data n Share Data n Balance Conflicting Requirements n Control Redundancy n Facilitate Consistency n Improve Integrity n Expanding Security n Increasing Productivity n Provide Data Independence

5 More information from the same amount of data n Data + Processing = Information

6 Share Data n Islands of data are difficult to share n Conflicts with file structures, naming conventions

7 Balance Conflicting Requirements n Different parts of the business have different uses for the data

8 Control Redundancy n Single authoritative source

9 Facilitate Consistency n One source – no conflicting data

10 Improve Integrity n Refer to single authoritative source n Ensure that single source is correct

11 Expanding Security n Put all your eggs in one basket n Watch the basket

12 Increasing Productivity n Only one place to store n Only one place to look n Prepare data once

13 Data Independence n Changes in the physical structure do not affect the logical structure = scalability

14 Topics n Manual database example

15 Manual database example

16 Structure n Fields, Records, Files n Columns, Rows, Tables n Attribute, Tuple, Relations n Rules: Types of data you can enter

17 More Complex Model n What if….

18 A Database is… n Tables n Relationships n Queries n Forms n Reports n Programs

19 A Student Record

20 A Few Students

21 Table View

22 A Few Students Kelly moves

23 Redundant Data leads to Inconsistent Data Bud moved too but now the addresses don’t match! His record still has the old address.

24 A Solution?

25 Move the data that is common to several records to a new table

26 A Solution!

27 A Solution

28 Relationships Primary Keys Foreign Key

29 Even More Relationships

30 Lots of Tables

31 Normalize? 1 st Normal Form At each row-column intersection, there must be one, and only one, value. F For example, a database would violate the rule for the first normal form if it stores, in a single row- column intersection, all of the scores for a bowler

32 2 nd Normal Form n Every non-key column must depend upon the entire primary key. n No non-key column is dependent on only a portion of the primary key u If the primary key is composite-made up of more than one component - no non-key column can be a fact about a subset of the primary key. u e.g. compound key firstname+lastname+province code would violate this rule, if another column was functionally dependent on the province code (John+Smith+BC) if “British Columbia” is functionally dependent on the code BC Only an issue if you have compound primary keys e.g. name + product code

33 3 rd Normal Form n No non-key column can depend on another non-key field u Each column must be a fact about the entity identified by the primary key u All determinants are candidate keys u e.g. in a table about people that contains a column with province codes, and another column with the full name of the province, the province code is a determinant of the full name, but is not a candidate key for the table of people Def n : Determinant A column that determines another column is a determinant

34 4 th Normal Form n There must not be any independent one-to-many relationships between primary key columns and non-key columns i.e. There are no multivalued dependencies IDAnswer1Answer2Answer3 223ABC 224BCA

35 5th Normal Form n Tables are broken into the smallest possible pieces in order to eliminate all redundancy within a table. n In extreme cases, tables in fifth normal form may consist of a primary key and a single non-key column. n High integrity n Slow performance n Redundancy due to extensive use of foreign keys

36 Summary – Normal Forms Normal Form Meaning/ConditionsNotes FirstNo repeating groups exist Second1NF + no nonkey column is dependent on a portion of the primary key If primary key is a single column then automatically 2NF Third2NF + the only determinants are candidate keys Boyce-Codd Normal Form Fourth3NF + no multivalued dependencies

37 A Historical Perspective Physical collections Flat Files Lists Indexes and pointers

38 Other Perspectives Hierarchical Structures Folders and Files Inverted Tree Organization Charts Single parent – many child relationships Network Multi – parent – many child relationships

39 What do you normalize? n Office u Supplies u Inventory n Office u Kitchen u Bathroom

40 Relational n Fields, Records, Files n Columns, Rows, Tables n Attribute, Tuple, Relations n Structure and Relationships

41


Download ppt "What's a Database A Database Primer Let’s discuss databases n Why they are hard n Why we need them."

Similar presentations


Ads by Google