Tutorial 3 DB U2000429
Tutorial 3 DB U2000429
Tutorial 3 DB U2000429
DATABASE
SEM 1, 2022/2023
Tutorial 3
1. Why business rules are important for a good database design? Give 3 examples of business
rules in academic environment.
Business rule help standardize company’s view of data and act as a communication tool
between users and designers. They allow the creator to develop relationship participation
rules and constraints and to create a correct data model. They also allow the creators to
understand business processes, and the nature, role and scope of the data.
Example: a. Every student must have at least 40% marks to pass a subject
b. Students need to have more than 80% attendance in order to sit for an exam
c. The maximum number of a lower grade subjects a student can take is 3
2. What is the definition of DDL and DML? Explain the differences between DDL and DML.
DML: environment in which data can be managed and is used to work with the data in the
database
DDL: enables the database admin to define the schema components
The difference is DML manipulate data inside database while DDL used when want to
create, delete or edit tables.
4. i. How would you identify entity and relationship types from a user’s requirements
specification?
To identify entity is by searching the nouns for example staff number or staff
names. It can also be a major object such as people or places. Typically,
relationships are indicated by verbs or verbal expression such as register, work etc.
ii. How would you identify attributes from a user’s requirements specification and
then associate the attributes with entity or relationship types?
The attributes can be identified where the noun or noun phrase is a property, quality,
identifier, or characteristic of one of these entities or relationships.
As there are generally many more attributes than entities and relationship, it may
be useful to first produce a list of all attributes given in the users’ requirements
specification. As an attribute is associated with a particular entity or relationship,
remove the attribute from the list. In this way, we ensure that an attribute is
associated with only one entity or relationship type and, when the list is empty, that
all attributes are associated with some entity or relationship type,
5. The following tables form part of a database held in a relational DBMS:-
where
Hotel contains hotel details and hotelNo is the primary key;
Room contains room details for each hotel and (roomNo, hotelNo) forms the
primary key;
Booking contains details of the bookings and (hotelNo, guestNo, dateFrom)
forms the primary key;
and
Guest contains guest details and guestNo is the primary key.
iii) Explain how the entity and referential integrity rules apply to these relations.
a. For each relation, the primary key must not contain any nulls. Room is
related to Hotel through the attribute hotelNo. Therefore, the hotelNo in
Room should either be null or contain the number of an existing hotel in the
Hotel relation. In this case study, it would probably be unacceptable to have
a hotelNo in Room with a null value. Booking is related to Hotel through the
attribute hotelNo. Therefore, the hotelNo in Booking should either be null or
contain the number of an existing hotel in the Hotel relation. However,
because hotelNo is also part of the primary key, a null value for this attribute
would be unacceptable. Similarly, for guestNo. Booking is also related to
Room through the attribute roomNo.