Upload
dinhnguyet
View
213
Download
1
Embed Size (px)
Citation preview
Database Design - Section 10 Instructor Guide
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page i
Table of Contents
Database Design - Section 10 ..........................................................................................................................1 Lesson 1 - Modeling Change: Time ..............................................................................................................1 What Will I Learn? ........................................................................................................................................2 Why Learn It?................................................................................................................................................3 Tell Me / Show Me........................................................................................................................................4 Try It / Solve It ..............................................................................................................................................8 Lesson 2 - Modeling Change: Price...............................................................................................................11 What Will I Learn? ........................................................................................................................................12 Why Learn It?................................................................................................................................................13 Tell Me / Show Me........................................................................................................................................14 Try It / Solve It ..............................................................................................................................................23 Lesson 3 - Adding the Time Element to the Animal-Shelter ERD................................................................27 What Will I Learn? ........................................................................................................................................29 Why Learn It?................................................................................................................................................30 Tell Me / Show Me........................................................................................................................................31 Try It / Solve It ..............................................................................................................................................32 Lesson 4 - Leaders in Information Technology.............................................................................................37 What Will I Learn? ........................................................................................................................................38 Why Learn It?................................................................................................................................................39 Tell Me / Show Me........................................................................................................................................40 Try It / Solve It ..............................................................................................................................................41 Lesson 5 - Review .........................................................................................................................................43 What Will I Learn? ........................................................................................................................................44 Why Learn It?................................................................................................................................................45 Tell Me / Show Me........................................................................................................................................46 Try It / Solve It ..............................................................................................................................................47
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 1
Lesson 1 - Modeling Change: Time
Lesson 1 - Modeling Change: Time
Lesson Preparation
We have covered modeling historical data in Section 8. This lesson will build on what was previously learned and take the discussion further. We will talk about whether to model an attribute date or an entity DAY, conditional nontransferability, and time-related constraints. This discussion is intended to make students aware of the issues involved in modeling data that changes over time.
What to Watch For None.
Connections None.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 2
What Will I Learn?
What Will I Learn?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 3
Why Learn It?
Why Learn It?
Why Learn It?
A florist-supply company may get orders for different types of flowers (roses, lilies, tulips, etc.) from several florists. They may want to track the quantities ordered for each type of flower over a three month period to help them plan their inventory for each season. A city police department tracks crimes in each neighborhood. They may want information on frequency of crimes during certain times of the year, such as holidays or during really hot or cold weather.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 4
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
You may want to remind the class that JOB ASSIGNMENT is the intersection entity that resolves the M:M relationship between EVENT and PARTNER.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 5
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
This is a good opportunity for a review of concepts learned previously. Ask the class: Why can’t we just add the attributes for high temperature and low temperature to the PURCHASE entity? Answer: Because those attributes depend on the attribute date, which is not part of the UID of PURCHASE. Remember the rule of Third Normal Form -- attributes can’t have attributes of their own. Ask students what other information may be of interest about a particular day other than just the date in other business scenarios? Possible answers include: Is it a holiday? Is it school day or a weekend? Is it a leap year or a snow day?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 6
Tell Me / Show Me
Tell Me / Show Me
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 7
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Mention that although the time-related constraints seem obvious in real life, they must be enforced by programming logic in the database. Therefore, they must be documented.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 8
Try It / Solve It
Try It / Solve It
Try It / Solve It
Assessment: Again, point out that putting weather condition as an attribute of SPEEDING TICKET would be a violation Third Normal Form. Weather condition depends on date, not on the UID of SPEEDING TICKET. A common mistake is to create a DAY entity and to leave the date attribute in SPEEDING TICKET. Clarify that date will be tracked as part of SPEEDING TICKET because of the relationship to DAY. (This will be clearer when we get to the lesson on foreign-key constraints).
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 9
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 10
Try It / Solve It
Try It / Solve It
Try It / Solve It
Assessment: (1) Why must start time be part of the UID? Answer: Because other exams can be scheduled in the same classroom on the same day, just not the same time. (2) Other time-related constraints: - Assignment periods may not overlap. (On a given date, the start time of an assignment for an exam may not be between the start time and end time of another exam for the same classroom. The end time of an assignment for an exam may not be between the start time and end time of another exam for the same classroom.) - You cannot move the assignment of an exam from one classroom to another unless the start date and time of the assignment is still in the future (conditional nontransferability). - Start date and time of an assignment may be updated to a later time, if that date and time is still in the future. - Start date and time of an assignment may be updated to an earlier time, if that date and time are still in the future.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 11
Lesson 2 - Modeling Change: Price
Lesson 2 - Modeling Change: Price
Lesson Preparation
None. What to Watch For
None. Connections
None.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 12
What Will I Learn?
What Will I Learn?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 13
Why Learn It?
Why Learn It?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 14
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Stock prices usually take a sharp dive or rise during times of crises or right before an announcement by the Federal Reserve. These as some things to take into consideration when deciding when to buy or sell. If fuel prices look as though they are on an upward trend, you may lean toward a more fuel-efficient car or a hybrid model. If you have an opportunity to “lock in” to a monthly heating rate with your energy company, you may want to do so. A contractor of a five-year bridge-construction project has to plan how much materials (cement, steel, equipment, etc.) to buy. If the price of cement is on the rise, the contractor may want to stockpile a lot of it.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 15
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
You can have students bring up other examples of things that are constantly going up in price. What kinds of things do their parents complain about all the time? (food, school tuition, clothing, etc.)
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 16
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Think about video-gaming systems. When the Sega Genesis was brand new, how much was it? How much can you buy it for now? You may want to track the "price-in-time" so that you can answer questions such as: How much was Sega Genesis in December 1999?\
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 17
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Have students name other items for which the price fluctuates. What about gold or silver? What about real estate? What about currency?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 18
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Do you really need an end date? It depends. If the various periods of a product price are contiguous, then you don’t need an end date. You can derive the end date from the start date of the next price associated with the item. However, if the products are not always available, as in the seasonal fruit and vegetable market, then you need an end date.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 19
Tell Me / Show Me
Tell Me / Show Me
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 20
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Note that you cannot model the “between relationship.” It needs to be documented and implemented with additional code in the system. You may also want to point out that PURCHASE HEADER may also contain other attributes or relationships to the CUSTOMER and the EMPLOYEE who processes the transaction. For simplicity’s sake, we don’t include them here.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 21
Tell Me / Show Me
Tell Me / Show Me
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 22
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
You may want to explain that PAYMENT could have additional attributes or relationships to PAYOR and PAYEE, but we have left them out of the diagram to keep things simple. Apart from the consequences for the conceptual data model, the system needs special journaling functionality: any business function that allows an update of PAYMENT amount should result in the requested update, plus the creation of an entity instance AMOUNT MODIFICATION with the proper values. This functionality has to be implemented by programming.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 23
Try It / Solve It
Try It / Solve It
Try It / Solve It Assessment: The model could be more complicated, depending on how much the students know about comic books, but the basic solution should have this.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 24
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 25
Try It / Solve It
Try It / Solve It
Try It / Solve It
CLASS will also have a relationship to TEACHER, but we have left that out for simplicity’s sake.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 26
Try It / Solve It
Try It / Solve It
Try It / Solve It
Assessment: The model could be more complicated, depending on how much the students know about cars, but the basic solution should have this.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 27
Lesson 3 - Adding the Time Element to the Animal-Shelter ERD
Lesson 3 - Adding the Time Element to the Animal-Shelter ERD
Lesson Preparation
In this lesson, we have students use DAY as an entity to capture data about adoption dates. They will also start thinking of reports, statistics, and documentation that can result from their data model. The same text appears in the student activities, but you may want to print this out for discussion purposes. Activity 2: Business Reports Think of at least one report or statistic that can be generated from the future system that includes these modifications. Document how you imagine these reports could be used in the business. For example: The staffing manager could run a “Receiving Report” that lists names of employees who received the animals and the dates received. If it looks as though some days of the week are a lot busier, and there are fewer employees working on those days, then more employees could be scheduled to work. Extension Activity (Challenge): Characteristics of Receiving Days We’d also like to capture data on the days that animals are brought to the shelter. Does it happen more after holidays? On rainy days?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 28
This will help us staff the shelter more appropriately if we anticipate a large number of animals being dropped off. In this lesson, we have students use DAY as an entity to capture data about adoption dates. They will also start thinking of reports, statistics, and documentation that can result from their data model. The same text appears in the student Activities, but you may want to print this out for discussion purposes. Activity 1: Characteristics of Adoption Days (1) Even though we did not require employees of the shelter to be part of the design, we do need to know which employee received the animal at the shelter. No need to tie it to our employee system -- we just want to capture the employee's name. (2) We also need to know the date and time that the animal was taken in at the shelter. (3) We also need to know special information about the date when the animal is adopted, (was the date a holiday) and special notes about the date. For special notes, we'd like to know things such as "general weather conditions" or "schools finish this week for summer." We’re trying to find trends that affect animal adoption. We need this information so that we can give good reports to our staffing manager about number of employees needed for each shift and on special days of the year. You don't need to design information about "shifts" (we already have that in the other system).
What to Watch For None.
Connections Ask students to think of examples in their school where time is something of importance about which the school needs to keep information. Possible answers include: - Monthly reports on student attendance that determine funding in some schools - Late arrivals at school can be recorded to determine absences - Lunch schedules - Kinds/quantities of foods ordered based on demand determined over time (around holidays, schools may order less?)
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 29
What Will I Learn?
What Will I Learn?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 30
Why Learn It?
Why Learn It?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 31
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Go over the new requirements with the students. Be sure they understand them before they start the exercises. You may want to hand out printed copies.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 32
Try It / Solve It
Try It / Solve It
Try It / Solve It
This is one possible solution to the Animal Shelter activity before the requested changes. You may want to print it and hand it out in class. This gives students a common starting point in case they did not come up with an accurate model or have a correct but significantly different one.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 33
Here is the model after the requested changes (in red). Explain to students that the client asked for employee's name, but there is no way to validate it against an actual list of employees. This may be a potential for a future enhancement to integrate with their existing employee system. Students should be aware that integration with other systems is a very common issue in consulting. Very rarely do consultants go to a company with no existing systems. That part of a project (integration with existing systems) can be very complicated!
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 34
Try It / Solve It
Try It / Solve It
Try It / Solve It
Assessment: Possible reports: (1) Report on average time between an animal being received and adopted. This could be used by the director to plan for animal housing and care while it is at the shelter (2) Report on the busiest employees -- who receives the most animals? (3) What time of day is the busiest or least busy for receiving animals? (4) What time of day is the busiest or least busy for people bringing animals to the shelter?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 35
Try It / Solve It
Try It / Solve It
Try It / Solve It
Assessment: This is tricky. They need to create a new relationship from the previously created DAY entity to the ANIMAL entity. If they are not comfortable with multiple relationships, they may want to create another DAY entity. Another challenge is the fact that this will assume that an animal may be dropped off only once (each ANIMAL can be received on one and only one DAY). This is not necessarily true. An animal can be dropped off and returned more than once. Do you assign the animal a unique ID each time it is dropped off? That’s not practical because you would not have the history of the animal. A quick solution would be to “bar” the relationship from DAY to ANIMAL so that the drop-off date would be part of the UID of ANIMAL (along with animal ID). However, this hides the real M:M nature between DAY and ANIMAL. Probably a better way would be to recognize that there is a M:M relationship between ANIMAL and drop-off DAY, and resolve it with an intersection enity such as ANIMAL RECEIVING HISTORY.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 36
You can discuss these issues in class to demonstrate that sometimes there are no easy answers in data modeling. There are many options and the good modeler evaluates them and their implications. Assessment:
Assessment:
Assessment:
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 37
Lesson 4 - Leaders in Information Technology
Lesson 4 - Leaders in Information Technology
Lesson Preparation
This “career skills” lesson aims to build positive associations between learning and work by showcasing meaningful contributions made to society by information-technology (IT) professionals (consider choices that include men, women, and underrepresented minorities). Students will research information about early pioneers in IT and people currently in IT (women of the year in IT, today's business leaders in IT, people who have used IT to make significant changes in our world) -- not necessarily all famous people but people who have jobs that they enjoy. Students will then answer questions to identify the contribution this IT professional is making in the information-technology world, recognize obstacles this person had to overcome, list the skills this person has acquired, and name personal qualities that make this person a leader.
What to Watch For None.
Connections None.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 38
What Will I Learn?
What Will I Learn?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 39
Why Learn It?
Why Learn It?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 40
Tell Me / Show Me
Tell Me / Show Me
Tell Me / Show Me
Here are some useful sites: http://www.cwheroes.org/home.asp Outstanding site: ComputerWorld Search for New Heroes website. The ComputerWorld Honors brings together the chairmen or chief executive officers of the world’s foremost information-technology companies with the world's leading universities, libraries, and research institutions to document a revolution in progress: the global information-technology revolution. http://www.informationtechnologyleaders.com/ Outstanding streaming video and written scripts of women and men in technology careers. Hosted by Laura Schildkraut, information-technology leaders is a series of one-on-one interviews with leading executives in information systems and information technology. The programs remind us that success in this discipline comes in all shapes and sizes and to shake off failures. Produced by the University of Washington Business School. http://www.witi.com/index.php Women in Technology International: Hall of Fame section with stories of outstanding women -- current and interesting
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 41
Try It / Solve It
Try It / Solve It
Try It / Solve It
Encourage students not to simply copy information off the Internet. Ask them to make some assumptions about the person based on the kinds of activities, interests, hobbies, and educational level the person has attained. Why do they think this person is recognized as an IT leader?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 42
Try It / Solve It
Try It / Solve It
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 43
Lesson 5 - Review
Lesson 5 - Review
Lesson Preparation
Review lesson content for fifteen minutes before you administer the quiz. This is a good time to answer questions, clarify recently learned concepts and terminology, and go over some of the practice solutions from previous lessons.
What to Watch For None.
Connections None.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 44
What Will I Learn?
What Will I Learn?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 45
Why Learn It?
Why Learn It?
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 46
Tell Me / Show Me
Tell Me / Show Me
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 47
Try It / Solve It
Try It / Solve It
Try It / Solve It
Allow 20 minutes for the quiz and 10 minutes for assessment/discussion afterward. Assessment: You may want to encourage students to retake the quiz until they achieve a passing score. Or you may prefer to allow only one attempt at the quiz. Have students work in small groups to review what they missed on the quiz. Based on what types of questions they missed, have students write out the rules (e.g., rules for subtypes). Have a member from each group present a summary back to the class about what areas their group can improve.
Copyright © Oracle, 2004. All rights reserved.
Database Design - Section 10 Page 48