Faculty of Science and Technology ITECH1006/5006 Database Management Systems Database Management Systems Tutorial Week 2 Tasks
1. Identify issues in the Crow’s Foot notations used in the following ERD.
“AUTHORS” should be “AUTHOR” – Entity name should be singular. “BOOK” should be “BOOK” – Entity name should be in uppercase. “IS WRITTEN BY” should be “writes” – Relationship name should be an active verb due to the positioning of the two entities.
Notes: The main purpose of this task is to get students to discuss the good convention in ER modelling. Generally, the labelling/naming of the entities, attributes, and relationships must be consistent. Students should stick to one set of notations, instead of switching sw itching between different sets (e.g. Chen Crow’s Foot). In this course, we expect students to use the Crow’s Foot notations.
2. Lucidchart - this product is a browser based diagramming tool; it is able to draw a wide range of different diagrams, including ER Diagrams. As a University student you are entitled to a free Lucidchart account. account. You can sign up for the free account using your university email address. When your account is created and an invitation email s ent to your FedUni student account (check Spam if the message is not in your inBox). Click on the link in your Lucidchart welcome email and you will be able to make use of the th e software. As a first step s tep you should look at the provided tutorials, in particular "Entity Relationship Diagrams". Diagrams ".
To prepare conceptual models (ERDs), you may use Lucidchart or any other drawing package. Notes: The main purpose of this task is to expose students to an ER diagramming tool. In this course, although students can use any software (including simple ones like MS-Word) for creating their ERD, I believe it would be much easier and less tedious if students could using a proper diagramming tool. Note that it is not in the scope of this course to teach every aspect of Lucidchart and students are expected to explore the tool independently.
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 1 of 6
3. Given a scenario represented by the following entities, where customers place orders for products: CUSTOMER - customer number, name, address, phone number ORDER - order number, order date, customer number and for each product ordered the quantity ordered and the total line price PRODUCT - product number, product description and product unit price An initial ERD using Lucidchart for this scenario would be:
This ERD only shows the primary keys of each of the entities, sometimes an ERD is drawn such that it will show all the non-primary key attributes for the model. In such a complete ERD you must not show or label foreign keys , the use of foreign keys indicates that you are looking at a logical model where a choice has been made to use a relational database, rather than a conceptual model. Prepare the ERD shown above using your choice of drawing tool and then create a copy of t his initial model and add all the non-primary key attributes listed in the scenario above to your copy. Solutions:
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 2 of 6
4. Use the above diagram and the business rules bel ow, create an Entity Relationship Diagram using Crow’s Foot notations. Include: o all appropriate connectivities, all cardinalities and at least the minimum number of attributes required to implement the model Business Rules: o A department employs many employees, but each employee is employed by one department. Some employees, known as "rovers," are not assigned to any department. A division operates many departments, but each department is operated by one division An employee may be assigned to many projects, and a project may have many employees assigned to it. A project must have at least one employee assigned to it. One of the employees manages each department, and each department is managed by one employee One of the employees runs each division, and each division is run by one employee. Solutions: Notes: The focus of this task is to get students to understand how to establish the connectivities, cardinalities and the participation on the relationships. After completing this task, students must understand that by deriving the business rules of an organisation, the above concepts of the relationships can be established. Students should also note that business rules differ from organisations to organisations. While modelling, if the rules are unclear, students are expected to make logical assumptions.
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 3 of 6
Notes: The purpose of Tasks 5 to 9 is to get students to practise ER modelling using the iterative modelling procedure taught in this course (see last slide for Learning Outcomes 5-7). When going through these tasks, students should understand how to establish if there is a relationship between two entities. They should also understand why some nouns are not modelled as entities or attributes, e.g. in Task 5, “car insurance company” are not modelled as an entity since we are modelling the data relationships in that company and information about itself is not relevant in that system. Finally, students should understand when i s a noun modelled as an entity and when as an attribute.
5. Design an ER diagram for a car insurance company whose customers own one or more cars
each. Each car has associated with it zero to many number of recorded accidents. DRIVER
CAR
One driver must drive at least one or more cars
Assumptions: One car may be driven by zero or one driver.
6. Acme Pty Ltd is made up of a number of departments that manage none or more projects. Each project is made up of none or more team members. Each team member belongs to one department. Each team member belongs to zero to one project. One of the team members supervise the o ther team members on the project.
Solutions:
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 4 of 6
7. Given the following business rules, create an ER diagram for each of the specified relationships: •
A company operates four departments
•
Each department employs staff
•
Each staff may work for one or more departments
•
A staff may be supervised by another staff
•
Each department has one manager.
Identify the entities and the attributes
Solutions:
8. Design an ER diagram for university registrar including the following entities: •
Courses, including course number, title, credits, syllabus, and prerequisites;
•
Course offerings, including course number, year and teaching period, instructors, timings and classroom
•
Students, including student-id, name, and program; and
•
Instructors, including identification number, name, department, and title.
•
Further, the enrolment of students in co urses and grades awarded to students in each course they are enrolled for must be appropriately modelled.
Document all assumptions that you have made
Solutions:
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 5 of 6
9. Prepare an Entity Relationship Diagram (ERD) showing all primary and non-primary key attributes for the following description of a Property Rental System: Properties are rented by tenants. Each tenant is assigned a unique number by the Agency. Data held about tenants include family name, given name, property rented, contact address street, city, state, postcode & telephone number. A tenant may rent more than one property and many tenants may rent parts of the same property (eg. a large shopping complex). Properties are owned by owners. Each property is assigned a unique building number. The agency only recognises a single owner for any of the properties it handles. The owner, address, and value are recorded for each propert y. In addition the lease period and bond are recorded for each property or sub property rented. An owner may own several properties. Properties are subject to damage and the agency records all instance of damage to its properties - property, date, type of damage and repair cost are recorded. Repair costs are charged directly to tenants Normal property maintenance is also noted - property, date, type of maintenance and cost are recorded. Maintenance costs are charged to the property owner. Tenants pay accounts to the Agency - these consist of weekl y rental payments, bond payments (for new properties) and damage bills. The date of payment, tenant, property, type of account (Rental, Bond, Damage) and amount are recorded.
Solutions:
CRICOS Provider No. 00103D
ITECH 1006 / 5006 Laboratory 2
Page 6 of 6