HomeworkHomework
Read “Introduction to Access” from Read “Introduction to Access” from texttext
Next Tuesday: turn in index card with Next Tuesday: turn in index card with three questions about readingthree questions about reading
DatabasesDatabases
Become common in 1970sBecome common in 1970s
If spreadsheets crunch If spreadsheets crunch numbersnumbers……databases crunch databases crunch informationinformation
Aren’t numbers information?Aren’t numbers information?
Managing InformationManaging Information
What is information?What is information?• How do I get to the Rotunda from here?How do I get to the Rotunda from here?• Is there a baby panda at the zoo?Is there a baby panda at the zoo?• When does the next bus come by?When does the next bus come by?• What’s your phone number?What’s your phone number?
These aren’t numerical questionsThese aren’t numerical questions
Logical RelationshipsLogical Relationships
How do I get to the Rotunda from How do I get to the Rotunda from here?here?
• Consider taking all actions from hereConsider taking all actions from here1.1. Where do I end up?Where do I end up?
2.2. Am I at the Rotunda?Am I at the Rotunda?
3.3. Consider taking all actions from thereConsider taking all actions from there1.1. Where do I end up?Where do I end up?
2.2. Am I at the Rotunda?Am I at the Rotunda?
3.3. Repeat…Repeat…
Logical RelationshipsLogical Relationships Consider taking Consider taking
all actions from all actions from herehere1.1. Where do I end Where do I end
up?up?2.2. Am I at the Am I at the
Rotunda?Rotunda?3.3. Consider taking all Consider taking all
actions from thereactions from there1.1. Where do I end up?Where do I end up?2.2. Am I at the Am I at the
Rotunda?Rotunda?3.3. Repeat…Repeat…
Logical RelationshipsLogical Relationships
A
G
H
C
F
E
D
B
I
AA B, CB, C
BB A, EA, E
CC A, D, E, HA, D, E, H
DD CC
EE B, C, F, GB, C, F, G
FF E, GE, G
GG E, FE, F
HH C, IC, I
II HH
Logical RelationshipsLogical Relationships
Is there a baby panda at the zoo?Is there a baby panda at the zoo?1.1. Create list of all animals at the zooCreate list of all animals at the zoo
2.2. Look for panda in the listLook for panda in the list
3.3. Return TRUE or FALSEReturn TRUE or FALSE
Logical RelationshipsLogical Relationships
When does the next bus come by?When does the next bus come by?1.1. Get bus tableGet bus table
2.2. Organize it by locationOrganize it by location
3.3. Sort by timeSort by time
4.4. Find entry closest to current time that Find entry closest to current time that is in the futureis in the future
What kind of tasks are being What kind of tasks are being repeated?repeated?
FindFind affiliated entries that follow affiliated entries that follow specific rulesspecific rules• B must be reachable from AB must be reachable from A• NameName must be panda must be panda• TimeTime must be in the future must be in the future
Database ExamplesDatabase Examples
Tables – The phone bookTables – The phone book• A column of namesA column of names• A column of addressesA column of addresses• A column of phone numbersA column of phone numbers
Database ExamplesDatabase Examples Hierarchical – A family treeHierarchical – A family tree
• Mary is mother of JohnMary is mother of John• John and Sue are parents of John and Sue are parents of
LizLiz• John and Sue are parents of John and Sue are parents of
LauraLaura
Derived informationDerived information• Mary is John’s momMary is John’s mom• John does not have another John does not have another
mommom• Laura and Liz are siblingsLaura and Liz are siblings
Mary
John
LauraLiz
Some Practical MattersSome Practical Matters
Tables and hierarchical databases Tables and hierarchical databases are monolithic and cumbersomeare monolithic and cumbersome• UpdatingUpdating• StoringStoring• DisseminatingDisseminating
ExamplesExamples
Telephone TablesTelephone Tables
Someone forgot to include the zip Someone forgot to include the zip code in the phone bookcode in the phone book• Add a column to the database and mail Add a column to the database and mail
a new phone book to everyone?a new phone book to everyone?
• Send an update book which contains Send an update book which contains only names and zip codes?only names and zip codes?
Family HierarchyFamily Hierarchy
Through remarriage, a person can Through remarriage, a person can have multiple mothershave multiple mothers• Family tree structure must be adjusted Family tree structure must be adjusted
to permit multiple momsto permit multiple moms• Entire tree must be rewrittenEntire tree must be rewritten
• Break the hierarchical organizationBreak the hierarchical organization• Permit everyone to have “parents” and Permit everyone to have “parents” and
define this in greater detail elsewheredefine this in greater detail elsewhere
Relational DatabasesRelational Databases
Multiple Tables!Multiple Tables!• Business recordsBusiness records
A table of products in inventoryA table of products in inventory A table of customer contact infoA table of customer contact info A table of product suppliersA table of product suppliers A table of current ordersA table of current orders
• customers -> productscustomers -> products• customers -> products -> supplier customers -> products -> supplier • credit card # -> customers -> productscredit card # -> customers -> products
VocabularyVocabulary
FieldField: a basic fact: a basic fact• There is a customer named ThomasThere is a customer named Thomas• There is a phone number: 924-HOOSThere is a phone number: 924-HOOS
RecordRecord: A set of fields: A set of fields• Customer names and phone numbers are Customer names and phone numbers are
relatedrelated• 924-HOOS --- Thomas924-HOOS --- Thomas
TableTable: A set of records: A set of records• Students at UVa listed with phone numbersStudents at UVa listed with phone numbers
DatabaseDatabase: A set of tables: A set of tables
Power of Relational DBsPower of Relational DBs
Lots of tables with relationships Lots of tables with relationships between thembetween them
Power of Relational DBsPower of Relational DBs
Efficiency and flexibility in storing Efficiency and flexibility in storing and retrieving informationand retrieving information• Easy to add / removeEasy to add / remove
New records and new descriptorsNew records and new descriptors
• Fast to retrieveFast to retrieve• Easy to customize for greater speedEasy to customize for greater speed• Easy to control securityEasy to control security
Only one writer at a time (ATM)Only one writer at a time (ATM) Exclude some readers (credit reports)Exclude some readers (credit reports)
Challenges of Relational DBsChallenges of Relational DBs
They become very complexThey become very complex Complexity leads to errorsComplexity leads to errors
• Stale relationshipsStale relationships The area codes for C’ville are updated in one table The area codes for C’ville are updated in one table
but not anotherbut not another
• Faulty fields in relationshipsFaulty fields in relationships A person is related to two different area codesA person is related to two different area codes
There’s an art to architecting databases that There’s an art to architecting databases that reduce these problemsreduce these problems
Top Related