Why design databases?
Poor database design gives rise to what is known as anomalies. To avoid the problems associated with poor database design, it is important that you understand what anomalies are. This reading from your textbook gives an overview of anomalies.
Once you have completed the interactive exercise, read the summary opposite which identifies three types of anomalies possible in poorly design databases
A database should never duplicate data.
To avoid all of these problems of data redundancy we need to take a close look at the next section, which will give us the tools to build functional databases.
Levels of modelling
In order to achieve a functional database we use models to represent the system we are analysing. The approach that designers use is detailed in the next short, interactive reading.
From the reading it is important that you understand the difference between the conceptual model, logical and physical models and how they come together.
Gathering system information
The conceptual model relies heavily on the business rules that are garnered from the client organisation. This is where communication skills will be invaluable.
If you don't know the client's requirements and business rules, you can't design the database.
Gathering business rules may take weeks and numerous interviews to complete.
Work your way through the textbook reading on Modelling the rules of the organisation. Don't worry about the references to chapters 1 & 2.
Some important points from this reading include:
- Scope of Business Rules: It is important that you
understand the scope
of the business rules you are gathering. You don't model anything but
the system in question. - Data Names: Note the six points that go into making a good data name.
- Data Definitions: Particularly important in describing
how a derived
attribute is calculated.
Honest Bob's Discount Warehouse
Identify the business rules that are pertinent to an invoice database below.
To do this:
- Roll your cursor over the scenario to identify the section of the text you think would become a rule.
- Click the text and write your rule.
- Check answers.
- Hint: there are 5 rules to be found
Scenario
Honest Bob's Discount Warehouse of 23 Dubious Lane Cheapside NT 8023 needs a computerised invoicing system. Because Honest Bob is a cheapskate they are still using a paper-based system.
The organisation has a number of customers, which are all businesses (Honest Bob's does not deal with the general public, which avoids all the problems with GST). Information kept on customers includes their ABN (CustABN), business name and address (which includes the address, suburb, state and postcode). Because Honest Bob's is keen on keeping their customers and having them return time after time, the prices there are suspiciously cheap.
When a customer purchases products they are given an invoice that lists the items purchased. Generally customers purchase a number of different items of varying quantities each time. If a customer decides that they haven't got enough of a particular item, instead of increasing the quantity for that item, Honest Bob's staff just add it again to the bottom of the invoice and give the new, updated copy to the customer.
Details on the invoice include the customer details, an invoice number, a date, an item number, its description, price, quantity ordered, subtotals for each item line and an invoice total.
View all rules for invoices.
Rule 1: A customer can receive many invoices
Rule 2: Each invoice is for one customer only
Rule 3: An invoice can contain more than one item
Rule 4: An item can appear on many invoices
Rule 5: An item can appear on an invoice more than
once
Company projects
Identify the business rules that are pertinent to a company projects database below.
To do this:
- Roll your cursor over the scenario to identify the section of the text you think would become a rule.
- Click the text and write your rule.
- Check answers.
- Hint: there are 3 rules to be found
Scenario
A company has a number of employees. The attributes of employee include employee_id (identifier), name, address, and birthdate. The company also has several projects. attributes of project include project_id (identifier), project_name, and start_date. Each employee may be assigned to one or more projects, or may not be assigned to a project. A project must have at least one employee assigned and may have any number of employees assigned. An employee's billing rate may vary by project, and the company wishes to record the applicable billing rate (billing_rate) for each employee when assigned to a particular project.
View all rules for company projects.
Rule 1: An employee can be assigned to many
projects
Rule 2: A project can have many employees
Rule 3: An employee's billing rate can vary for each
project
Grade report
Identify the business rules that are pertinent to an grade report database below.
To do this:
- Roll your cursor over the scenario to identify the section of the text you think would become a rule.
- Click the text and write your rule.
- Check answers.
- Hint: there are 5 rules to be found
Scenario
From the sample grade report below, what business rules can you deduce? Assume that each course is taught by one instructor.
MILLENIUM COLLEGE GRADE REPORT FALL SEMESTER 200X |
||||
NAME: | Emily Williams | ID: 268300458 | ||
CAMPUS ADDRESS: | 208 Brooks Hall | |||
MAJOR: | Information Systems | |||
COURSE | TITLE | INSTRUCTOR NAME | INSTRUCTOR LOCATION | GRADE |
|
||||
IS350 | Database Mgt | Codd | B104 | A |
IS465 | System Analysis | Parsons | B317 | B |
Based on your current enrolment, what other assumptions can be made?
View all rules for grade reports.
Rule 1: A student can enrol in many courses
(units)
Rule 2: A student receives a grade for each course
Rule 3: A course is taught by only one instructor
Rule 4: A course can have many students
Rule 5: An instructor can teach many courses
Real estate firm
Identify the business rules that are pertinent to an real estate database below.
To do this:
- Roll your cursor over the scenario to identify the section of the text you think would become a rule.
- Click the text and write your rule.
- Check answers.
- Hint: there are 9 rules to be found
Scenario
- The firm has a number of sales offices in several states. Attributes of sales office include Office_Number (identifier) and Location.
- Each sales office is assigned one or more employees. Attributes of employee include Employee_ID (identifier) and Employee_Name. An employee must be assigned to only one sales office.
- For each sales office, there is always one employee assigned to manage that office. An employee may manage only the sales office to which he or she is assigned.
- The firm lists property for sale. Attributes of property include Property_ID (identifier) and Location. Components of Location include Address, City, State and Zip_Code.
- Each unit of property must be listed with one (and only one) of the sales offices. A sales office may have any number of properties listed or may have no properties listed.
- Each unit of property has one or more owners. Attributes of owners are Owner_ID (identifier) and Owner_Name. An owner may own one or more units of property. Owners own a percentage of a property.
View all rules for real estate.
Rule 1: A sales office has many employees
Rule 2: An employee is assigned to one sales office
Rule 3: A sales office has one employee who is a
manager
Rule 4: A manager must be an employee assigned to a
sales office
Rule 5: A sales office has many properties listed
Rule 6: A property is only listed with one sales
office
Rule 7: A property can have many owners
Rule 8: An owner can own many properties
Rule 9: Each owner owns a percentage of a property
Courts
Identify the business rules that are pertinent to a courts database below.
To do this:
- Roll your cursor over the scenario to identify the section of the text you think would become a rule.
- Click the text and write your rule.
- Check answers.
- Hint: there are 8 rules to be found
Scenario
- An attorney is retained by one or more clients for each case.
- Attributes of attorney are: attorney_id, name, address, city, state, zip_code, specialty (may be more than one), bar (may be more than one).
- A client may have more than one attorney for each case.
- Attributes of client are client_id, name, address, city, state, zip_code, telephone, date of birth.
- A client may have more than one case.
- Attributes of case are case_id, case_description, case_type.
- An attorney may have more than one case.
- Each case is assigned to one and only one court.
- Attributes of court are court_id, court_name, city, state, zip_code.
- Each court has one or more judges assigned to it.
- Attributes of judge are judge_id, name, years in practice,
- Each judge is assigned exactly to one court.
View all rules for courts.
Rule 1: An attorney can have many clients for a
case
Rule 2: A client can have many attorneys for a case
Rule 3: A client can have many cases
Rule 4: An attorney can have many cases
Rule 5: A case is assigned to one court
Rule 6: (Implied) A court can have many cases
Rule 7: A court can have many judges
Rule 8: A judge is appointed to one court