database design (3) is 240 – database management lecture #12 – 2004-03-30 prof. m. e. kabay,...
TRANSCRIPT
![Page 1: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/1.jpg)
Database Design (3)
IS 240 – Database ManagementLecture #12 – 2004-03-30
Prof. M. E. Kabay, PhD, CISSP
Norwich University
![Page 2: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/2.jpg)
2
Topics
SubtypesTreesNetworksBill of MaterialsSurrogate KeysNull Values
![Page 3: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/3.jpg)
3
Subtypes (1)
Consider a currency-trading operationThere’s a counter for walk-in anonymous clients
Need only date, time, currency_in, rate, currency_out, fee; customer_ID is set to 0.
People who use the service often can become regular customers and receive a monthly statement of all transactionsIn addition to info above, need name,
customer_ID, address etc.Corporate customers have a corporate_ID and a
list of authorized usersTheir monthly report includes a total_fees field
that gives the aggregated total for all users
![Page 4: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/4.jpg)
4
Subtypes (2)
Show diagrams for the relations above as subtypes of customer
Why not lump all the customers into a single relation?
![Page 5: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/5.jpg)
6
Subtypes (3)
Show the tables you could create to represent the situation described above
![Page 6: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/6.jpg)
8
Trees
Many systems involve hierarchical 1:N relationsAdministrative hierarchies
Department, directorate, division, unit…Polychotomous classifications of various
kindsKingdom, phylum, class, order, family…
Every element in tree is a nodeTop level of classification: rootParent nodes have child nodes in a branchA child node can have one and only one
parent
![Page 7: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/7.jpg)
9
Trees (cont’d)How can you represent the relationships in a
tree? Consider a system for tracking students in college dormitories:
College
Dormitory
Floor
Room
Student
![Page 8: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/8.jpg)
10
Networks
In simple networks an entity may have more than one parent
The parent entities have M:N relations to the child entities
Give an example of a network using doctors, nurses and patients in a health-care system
![Page 9: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/9.jpg)
11
Network: Doctors, Nurses, Patients
Draw the health-care example you have developed
![Page 10: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/10.jpg)
13
Bill of Materials
In manufacturing systems, many components may contain many partsTrying to model these relations caused
headaches in the early years of DBMS design
Why?Solution: treat the relation as recursive
Every element is described in its own tableEvery relationship is described by the
container and the contained elementsStructure thus very simple – now draw it!
![Page 11: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/11.jpg)
14
Bill of Materials Design
![Page 12: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/12.jpg)
16
Surrogate Keys
To link two relations in a relationship table, we need unique IDs
What if the key we use when designing a relation is not in fact unique?What happens to our tables?
What if the keys we use are very long?What about efficiency?
![Page 13: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/13.jpg)
17
Surrogate Keys (cont’d)
DBMS can supply a system-assigned unique identifierTypically a simple numberTakes little roomEasy to use in indexingPrevents duplication of keys
How do we use these unique identifiers in our relationship table?Show an example with doctor/patient
What is the main disadvantage of this surrogate key technique?
![Page 14: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/14.jpg)
18
Null Values
What are the possible meanings of a field that has not been filled in by a user (a null or empty field)?
For inappropriate values (e.g., gender-specific attributes), should you always use subtypes?
Can also assign a blank value ab initioChange blank to N/A or UNKNOWN if
necessaryMust handle these values in code (why?)
![Page 15: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/15.jpg)
19
HOMEWORKReview Chapter 6 of Kroenke
Prepare for next class by applying SQ3R to chapter 8 of Kroenke.
REQUIRED: By Tuesday 6 April, complete and hand in answers to review questions 6.25 through 6.36 for 24 points.
OPTIONAL: Also by Tuesday 6 April, for an extra 2 points each, complete any or all of Projects 6A, 6B or 6C.
(More homework possibilities for extra credit on next page)
![Page 16: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/16.jpg)
20
HOMEWORK (cont’d)
For a 2 extra points each, complete any or all of the FiredUp projects A through D on pp 180-181. To submit B you must first do ATo submit D you must first do C
![Page 17: Database Design (3) IS 240 – Database Management Lecture #12 – 2004-03-30 Prof. M. E. Kabay, PhD, CISSP Norwich University mkabay@norwich.edu](https://reader036.vdocument.in/reader036/viewer/2022062511/551472ae550346494e8b6132/html5/thumbnails/17.jpg)
21
DISCUSSION