Uploaded by bhavik11187

Tutorial 2 ER Modelling 21Oct2020(1)

advertisement
PgD/MSc IT
Database Design Comp11007
Tutorial Two: Data modelling using ER model concepts
Question One
Given the following descriptions, create an appropriate ER diagram for each of the specified
relationships.
a) Each company operates more than one department, and each department belongs to one
company.
b) Each department in part (a) employs one or more employees, and each employee works
for one department.
c) Each of the employees in part (b) may or may not have one or more dependents, and
each dependent is the dependent of one employee.
Question Two
Represent all the relationships described in Question One as a single ER diagram.
Question Three (optional)
Suppose you are involved in developing a database system for the Sales Department of a
company. The operation of the Department can be described as follows:
They have a file of products that they provide to their customers. Each type of product has a
unique product number, as well as a description, a cost, a price and the quantity in stock. The
quantity in stock is updated regularly. When the quantity in stock decreases to the reorder
level, a fixed quantity of the product is reordered.
They have a file of customers. Each customer is given a unique customer number. This file
also contains customer names that consist of their first and last names, customer addresses
composed of street, city and postcode and the customer telephone number. Customers have a
credit limit, which is used to validate their orders.
A customer may place zero, one or more orders at a time, and an order is always placed by
one customer. A unique order number identifies each order. Other information as to orders
includes the date due, the total price, and the status (e.g. outstanding, delivered, etc.).
Each order request one or more than one product, and a product may be requested by more
than one order. For each product being ordered in an order, its quantity is recorded. A
product may have many components products but not every product is a component of
another product.
 Given the above data requirements, create a conceptual schema (an ER diagram) for the
Sales Department using the ER model concepts. Specify the following:

Identify entities and their attributes and state attribute types, (i.e. unique,
composite, etc.);

Identify relationships, their attributes (if any) and structural constraints;

Draw partial ER diagrams showing each entity and all its attributes individually;

Draw a simplified ER diagram showing all entities, the relationships between
them (including structural constraints, and relationship attributes (if any)).
1
Note: only primary key attributes or partial keys (for weak entities) should be
included in the simplified ER diagram (see examples in lecture notes)
Question Four (optional)
A printing company that handles print jobs for book publishers wishes to create a database to
control publishers’ requests for printing. The database should keep track of each publisher
name, address (town, street, and post code), telephone and fax numbers, publisher web
address, and contact email address. A book publisher requests one or more print jobs. A print
job requires the use of print items (e.g. paper, ink, etc.) which are requested through one or
more purchase orders. Each print job is requested by one book publisher only.
Data stored on each print job should include a print job number, description, start date,
completion date, and cost. Each purchase order requests one or more print items. Not every
print item is always requested but can be requested by many purchase orders. The quantity of
each item requested in a purchase order should also be recorded in the database. A unique
purchase order number, order date, status, and total cost are recorded for each purchase order.
Print item code, name, and description are stored in the database for each print item.
Each print job is assigned to one or more employees. Not every employee is assigned a print
job but can be assigned many print jobs. Each publisher publishes many books, but a book is
published by one publisher only. The ISBN number, title, year of publication, price and
author(s) of each book are recorded in the database. A unique employee number, name (first
and last), address, gender, date of birth and salary are stored for each employee.
 Given the above data requirements, create a conceptual schema (an ER diagram) for the
Printing Company using the ER model concepts. Specify the following:
 Identify entities and their attributes and state attribute types, (i.e. unique, composite,
etc.);
 Identify relationships, their attributes (if any) and structural constraints;
 Draw partial ER diagrams showing each entity and all its attributes individually;
 Draw a simplified ER diagram showing all entities, the relationships between them
(including structural constraints, and relationship attributes (if any)).
Question Five
An IT training company offers many training courses each of which is taught by a team of
instructors. Each teaching team consist of up to four instructors.
Each teaching team teaches one or more courses, but a course is taught by only one team. An
instructor is assigned to a maximum of two teaching teams or may be assigned to do a
research project. Each research project is performed by one instructor only.
A trainee must join more than one training session to complete all courses. Every training
session offers one or more courses and can accommodate up to 100 trainees. A training
course is offered in more than one training session.
An instructor is identified by his/her national insurance number, the teaching team by the
team number, the course by the course code, a trainee by his/her matriculation number, and a
2
training session by the session number and a research project by its title. In addition, each
instructor name (first and last names), phone number, and date of birth is also recorded.
 Given the above data requirements create a conceptual schema (an ER diagram), using the
Entity-Relationship model concepts, for a database that will meet the information needs
for the company’s training program. Specify the following:
 Identify entities and their attributes and state attribute types, (i.e. unique, composite,
etc.);
 Identify relationships, their attributes (if any) and structural constraints;
 Draw partial ER diagrams showing each entity and all its attributes individually;
 Draw a simplified ER diagram showing all entities, the relationships between them
(including structural constraints, and relationship attributes (if any));
 Using the ER diagram created above can you answer the following questions:
1) Which courses did a trainee take?
2) Which courses did he/she take and in which session?
If answer is No, what is the solution?
3
Download