0% found this document useful (0 votes)
16 views

Tutorial 2

Uploaded by

anthonytutmulai8
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Tutorial 2

Uploaded by

anthonytutmulai8
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

IS302 Database Design

Topic: Data Models

Tutorial Exercise 1

1. In your own words, describe each of the following terms:


a. Data: Data refers to raw facts, figures, or values that are collected, stored, and processed in a
meaningful context. It can be in various forms, such as text, numbers, images, or multimedia.

b. Field: A field is a specific piece of data within a database record. It represents a single
characteristic or attribute of an entity, such as a person's name, age, or address. Fields are
organized into columns in database tables.

c. Record: A record, also known as a row or tuple, is a collection of related fields that represent a
single instance or entity within a database table. It contains all the data pertaining to a particular
entity, such as a customer, product, or transaction.

d. Data Redundancy: Data redundancy refers to the unnecessary duplication of data within a
database system. It occurs when the same data is stored multiple times in different parts of the
database, leading to inefficiency, inconsistency, and increased storage requirements.

e. Data Independence: Data independence is the concept that database applications should be
unaffected by changes made to the way data is stored or structured in the underlying database
system. It is divided into two types: logical data independence, which refers to the ability to
modify the logical schema without affecting the application's external view, and physical data
independence, which refers to the ability to modify the physical schema without affecting the
logical schema.

f. Metadata: Metadata is data that provides information about other data within a database. It
describes the structure, organization, and properties of the data, including data types,
relationships, constraints, and security settings. Metadata is used to facilitate data management,
querying, and interpretation.

g. DBMS (Database Management System): A DBMS is a software system that provides an interface
for users to interact with databases. It enables the creation, storage, retrieval, manipulation, and
management of data in a structured and efficient manner. A DBMS provides various features,
including data definition, data manipulation, data querying, data integrity, concurrency control,
and security. Examples of DBMSs include MySQL, Oracle Database, Microsoft SQL Server, and
PostgreSQL.
2. Differentiate between data, information, and a database
 Data consists of raw facts
 Information is the result of processing raw data to reveal the meaning of data
 A database is a shared, integrated computer structure that stores a collection of the End
user data and meta data.
3. List advantages and disadvantages of a DBMS.
 Improved data sharing
• Improved data security
• Better data integration
• Minimized data inconsistency
• Improved data access
• Improved decision making
• Increased end-user productivity
4. List and describe the different types of databases.
5. State the main components of a database system.
 Hardware- pc, laptops, servers & web servers, networking cables, access point
 Software –os, dbms, users, network administrators
 People-
 Procedures- find what type of data to be stored
 Data-
6. Explain why database design is important.
A poorly designed database causes difficult to trace errors that may cause a lot of problems for the
business that is why database design is important. A well- designed database facilitates data
management and generates accurate and valuable information.

7. Explain the difference between unstructured and structured data.


 Unstructured Data- is data stored in its native format or it exits in its original state.
Unstructured data can be audio or video files that cannot fit neatly into tables unlike
structured data.
 Structured Data- is standardized, clearly defined, and searchable data which is the result of
formatting unstructured data causing it to have less storage space unlike unstructured
data.

Tutorial Exercise 2

Review Questions
1. Discuss the importance of data modeling.
Data modeling refers to the process of creating a specific (data model) representation of complex
real-world data structures for a determined problem domain. Database designers use existing data
modeling to construct powerful database design tools that reduce potential errors in database
modeling. It is unlikely to create a good database without first creating an appropriate data model.
Data modeling defines and helps structure the data in a meaningful way and ensures data is
organized logically making it easier to understand and manage. This provides a foundation for data
analysis and decision making activities.
In conclusion, data modeling is a critical component of modern data management practices, enabling
organizations to effectively structure, manage, and leverage their data assets to drive informed
decision-making, ensure data integrity, and support business objectives.
2. Define what a business rule is and briefly explain its purpose in data modeling.
A business rule is a brief, precise, and unambiguous description of a policy, procedure, or principle
within a specific organization. These business rules apply to any organization that stores and uses
data to generate information. Business rules are used to define entities, attributes, relationships, and
constraints that must be easy to understand and widely disseminated.
Business rules are essential to database design because:

 It helps standardize the company’s view of data


 It can be a communication tool between users and designers
 It allows the designer to understand the nature, role, and scope of the data
 It allows the designer to understand business processes
 It allows the designer to develop appropriate relationship participation rules and constraints
and to create an accurate data model
3. Explain how business rules are translated into data model components.
Business rules define objects of interest within the rule and determines the relationships between
these objects. For example, a business rule for an organization is that “a customer may generate
many invoices”. The objects of interest here are customers and invoices, and this generates a
relationship between customers and invoices. After the relationship type is identified, the rule then
becomes a data model component.

Tutorial Exercise 3
Topic: Relational Data Model

Review Questions
1. Define the following terms as they apply to the relational data model: domain, attribute, tuple, and
degree of relation.
 Domain- Think of a domain as the range of acceptable values for a specific attribute.
For example, if you have an attribute called "age," the domain might include integers
between 0 and 150.
 Attribute- Attributes are like characteristics or properties of entities. For instance, in a
"Student" entity, attributes could be things like "student ID," "name," and "age."
 Tuple- tuples are individual entries or rows in a table. Each tuple represents a complete set
of attribute values for a single entity. So, for example in a table of students, each row
would be a tuple containing details about a specific student.
 Degree of relation- This simply refers to the number of attributes (or columns) in a relation
(or table). It's like the width of your table—it tells you how many different pieces of
information are stored for each entity.
2. Explain the difference between a database and a table.
 A table is an organized set of data that is arranged into rows and columns in a Database
Management System (DBMS), while a database is a collection of related tables.
 A table is a two-dimensional structure composed of rows and columns. It is a persistent
representation of a logical relationship whose contents can be saved permanently for
future use. It contains a group of related entity occurrences. A database is where these
tables are stored.

3. Explain the difference between a super key, a candidate key and a primary key.
 Super Key – A super key is a group of single or multiple keys which identifies rows in a
table.
 Primary Key – is a column or group of columns in a table that uniquely identify every
row in that table.
 Candidate Key – is a set of attributes that uniquely identify tuples in a table.

4. Explain why one of the candidate keys of a relation is designated as the primary key.
Because regardless of how many candidate keys a relation may have, only one field can actually be
used as the primary key for a given table.

5. Explain what it means to say when a database displays both entity integrity and referential integrity.
 Entity integrity in databases is a condition where the rows in all of the tables can be
uniquely identified using the primary key of its corresponding table.
 Referential integrity in databases is a condition in which every reference to an entity
instance by another entity instance is valid. Every foreign key entry must either be null
or a valid value in the primary key of the related table.

6. Explain the importance of entity integrity and referential integrity in a database.


 Having an entity integrity in your database is important because you can reference every
row in a table and searching for a specific row will always give you right results. Failure in
getting the correct data will only result in confusion and wrong decision making.
 Referential integrity is also important because it ensures that only a valid foreign key can
be assigned to a table. You cannot add an invalid value to the related table which
eliminates possible data entry errors that you might make.

7. Discuss reasons that lead to the occurrence of NULL values in relations.


(i) When a particular attribute does not apply to an entity;
(ii) Value of an attribute is unknown, although it exists;
(iii) When the value is unknown because it does not exist.
(iv) Optional Attributes- attributes that are not mandatory or required for all entities. For
example, middle name in student table may be optional resulting in null value.
(v) Unknown Values- cases where the actual value of the attribute is unknown and cannot be
identified at the time of data entry due to incomplete data collection.

8. Discuss the various update operations on relations and the types of integrity constraints that must
be checked for each update operation.

4. Describe the basic features of the relational data model.


The relational data model is a model for representing data in the form of tables composed of
intersecting rows and columns. The basic features of a relational data model are:

 Tables – data is organized into tables, sometimes referred to as relations. Tables represent
entities such as employees, customers and so forth. Tables are identified by their names and
contain related data elements. And are composed of rows and columns.
 Rows – are sometimes called tuples, and each tuple represents a single occurrence or
instance of the entity being modeled.
 Columns – are referred to as attributes, that represents the characteristics or attributes of
the entity being modeled. Each column has a name and data type.
5. Explain why an object is said to have greater semantic content than an entity.
An object is an abstraction of a real-world entity that has both data and its relationship as well as
behavior contained in a single structure. The attributes describe the properties of an object. Entities
are represented as tables and captures data in rows and columns that may not capture the full
semantic of the real-world entity.
6. Explain the difference between an object and a class in the object-oriented data model (OODM).
An object is a single structure that contains both the data and the relationship, while a class is a
collection of similar objects with shared structure and behaviour.
7. What is a relationship?
Relationship in the context of database modeling refers to the association or connection between
two or more entities using common fields, that used for connecting different pieces of information
within a database.
8. Explain three types of relationships. Support your explanation with an example of each.
There are three types of relationships:

 One-to-one (1:1) – occurs when one record of an entity is directly associated with exactly
one record in another entity and vice versa. For example, incase of CEOs, one office can
belong to one CEO, and one CEO can have one office.
 One-to-many (1:M) – occurs when one record of an entity is associated with one or more
records in another entity, however, each record in the second entity is associated with only
one record on the first entity. For example, one course is taught in multiple classes, and one
class can only teach one course at a time.
 Many-to-many (M:M) – occurs when each record of an entity can be associated with one or
more records in another entity and vice versa, and this requires a junction table. For
example, one student can be enrolled in multiple classes, and one class can enroll multiple
students.

9. Define what a table is and briefly explain its role in the relational model.
A table is a structure composed of rows and columns used to organize, store and display data. Each
row represents a record and each column represents a specific attribute or field. Some roles of tables
are:

 Organizing data in a structured format


 Represent entities or subjects
 Used to draw relationships between entities
 Defines the attribute of entities being modeled
 Building blocks for designing a database
10. Explain the difference between logical independence and physical independence.
Logical independence is when you change the internal model without affecting the conceptual
model, while physical independence is when you change the physical model without affecting the
internal model.
11. What is a connectivity?

Connectivity refers to the relationships or associations between entities or tables in a relational


database. It describes how entities are connected and linked to each other within the database.

Problem Solving Question

The diagram below shows the initial entities and attributes for a college.
Using the figure above, answer the following questions.

a. Identify all relationship types.


There are 2 relationships present in the diagram above:
 one-to-many
 Many to many

b. Write down all business rules.


Some business rules identified above are:
 One course is taught in multiple classes, and one class can only teach one course at a time.
 One student can be enrolled in multiple classes, and one class can enroll multiple students.

c. Create a basic Crow’s Foot ERD diagram for the college.

You might also like