Tutorial 2
Tutorial 2
Tutorial Exercise 1
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.
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:
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.
8. Discuss the various update operations on relations and the types of integrity constraints that must
be checked for each update operation.
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:
The diagram below shows the initial entities and attributes for a college.
Using the figure above, answer the following questions.