0% found this document useful (0 votes)
4 views23 pages

Independent Learning Database

The document provides an overview of the relational data model and entity-relationship model, highlighting key concepts such as relations, tables, attributes, and entities. It explains the structure of databases, including the organization of data into rows, columns, and cells, as well as the types of attributes that can exist within a database. Additionally, it covers the importance of entity-relationship diagrams in representing database schemas and the relationships between different entities.

Uploaded by

gasanatesieva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views23 pages

Independent Learning Database

The document provides an overview of the relational data model and entity-relationship model, highlighting key concepts such as relations, tables, attributes, and entities. It explains the structure of databases, including the organization of data into rows, columns, and cells, as well as the types of attributes that can exist within a database. Additionally, it covers the importance of entity-relationship diagrams in representing database schemas and the relationships between different entities.

Uploaded by

gasanatesieva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

INDEPENDENT LEARNING

Read through this lesson, try to understand and ask your fellow where you don’t
understand.
Note: All slides should be covered in one period
RELATIONAL The relational data model was
MODEL introduced by C. F. Codd in 1970.
Currently, it is the most widely used
data model. The relational data
model describes the world as “a
collection of inter-related relations
(or tables).”
Relation
A relation, also known as a table or
file, is a subset of the Cartesian
product of a list of domains
characterized by a name. You can
also think of it this way: an attribute
is used to define the record and a
record contains a set of attributes.
RELATIONAL MODEL
Table

Data is stored in rows and columns. Each Row is known as


record and the data items are known as fields. Tables
contain data about one type of item, person or event, for
example:

 a table of patients

 a table of a student

 a table of teacher

 a table of books

 a table of doctor’s appointment

For a book the fields could include: title, author, ISBN,


Publication house
RELATIONAL MODEL
Column

A database stores pieces of information or facts in an organized way.


The principal storage units are called columns or fields or attributes.
These house the basic components of data into which your content can
be broken down.

Records

Each row represents a group of related data values, such as a customer


or an employee. A row, or record, is also known as a tuple

Cell

The link/intersection between column and record is known as cell. It


also needs to be available so that they can be reconstituted into their
whole form, the basis of all databases.

A simple table below gives us the clearest picture of how records and
fields work together in a database storage project.
RELATIONAL MODEL
RELATIONAL MODEL
Null value

In many situations every row and column will contain data, but there
are cases where it makes sense for some columns to not contain a
value.

In our example StudentId cannot be null because it is unique, but Sex


can be null because it is optional field

Degree

The degree is the number of attributes in a table. In our example


above, the degree is 4.
RELATIONAL Domain

MODEL A domain is the original sets of atomic values used


to model data. A domain is a set of acceptable
values that a column is allowed to contain.

For example:

• The domain of Marital Status has a set of


possibilities: Married, Single, Divorced, Widowed.

• The domain of Shift has the set of all possible


days: {Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday and Sunday}.

• The domain of Salary is the set of all floating-


point numbers greater than 0 and less than
200,000 FRW.

• The domain of First Name and Surname is the set


of character strings that represents names of
people.
RELATIONAL MODEL
Datatype

Each field in a record has its own data type. The data types in the fields
can be text, alphanumeric, numeric, and Boolean or date/time.
DATABASE DESIGN:
ENTITY-
RELATIONSHIP
MODEL
Objectives: By the of this lesson, learners will be able to:
- Describe components of Entity-Relationship model,
The entity relationship (ER) data model has existed for over
35 years. It is well suited to data modelling for use with
databases because it is fairly abstract and is easy to discuss
and explain. ER models are readily translated to relations.
ER models, also called an ER schema, are represented by ER
diagrams.

DATABASE ER modelling is based on two concepts:


DESIGN:
ENTITY-
RELATIONSHIP
MODEL Entities, defined as tables that hold specific information
(data)

Relationships, defined as the associations or interactions


between entities
Entity Relationship Diagram

The ER diagram is used to


DATABASE represent the conceptual database
DESIGN: schema.
ENTITY-
RELATIONSHIP
MODEL In ER diagram: Entity, Attributes
and Relationships form the
components of ER Diagram and
there are defined symbols and
shapes to represent each one of
them.
Entity Relationship Diagram

1. Entity type

DATABASE A rectangle represents an entity type.


DESIGN:
ENTITY- Entity types are similar to classes; they describe
RELATIONSHIP potential objects (entities) that will appear in the
database. Weak entity types describe dependent
MODEL entities, entities that depend on other entities for
identity.

Entity type/ Strong entity

Strong entity is an entity that not Weak entity is an entity type that
existence-dependent on some is existence-dependent on some
other type. E.g. Student other entity type. E.g. Marks
Entity Relationship Diagram

2. Relationships between
Entities
DATABASE
DESIGN: A diamond represents a
ENTITY- relationship.
RELATIONSHIP
MODEL
Entity Relationship Diagram

3. Attribute
DATABASE
DESIGN: An ellipse represents an
ENTITY- attribute (Property).
RELATIONSHIP
MODEL
Entity Relationship Diagram

3. Attribute

DATABASE An attribute is a data item that describes a


DESIGN: property of an entity set. Attributes
determine, explain, or categorize an entity
ENTITY- set. Attributes have values, which can be of
RELATIONSHIP different data types such as numbers,
MODEL character strings, dates, images, sounds, and
so on. In a physical model, an attribute is a
named column in a table. Each table has a list
of attributes (or columns).
Entity Relationship Diagram

3. Attribute

DATABASE The types of attributes


DESIGN:
ENTITY-
RELATIONSHIP
Simple (atomic) attribute – This type of
MODEL attribute has a single component.
For example, the Gender attribute has a single
component with two values.
In the COMPANY database, an example of this
would be: Name = {John} ; Age = {23}
Entity Relationship Diagram

3. Attribute

The types of attributes


DATABASE
DESIGN:
ENTITY- Composite attribute – A composite
RELATIONSHIP attribute consists of many components.
MODEL
For example, the Name attribute has the components Last
name and First name. So this would be written as → Name
= {KAGABO+Peter}
Address may consist of Province and District, Number,
Avenue. So this would be written as → Address = {KG +‘14’
+ ‘Av’}
Entity Relationship Diagram

3. Attribute
DATABASE
DESIGN: The types of attributes
ENTITY-
RELATIONSHIP Single valued attribute – This
MODEL
type of attribute has one value
for one entity.
For example, the Title attribute
has a single value for each
teacher.
Entity Relationship Diagram

The types of attributes

Multi-valued attribute – A multi-valued


DATABASE attribute has many values for one entity.
DESIGN: An example of a multivalued attribute from the
COMPANY database, as seen in Figure below, are
ENTITY- the degrees of an employee: BSc, MSc., PhD.
RELATIONSHIP
MODEL
Entity Relationship Diagram
The types of attributes

Derived attribute – A derived attribute has its value computed from another attribute or
attributes.

DATABASE A derived attribute is not a part of a table from a database, but is shown for clarity or

DESIGN:
included for design purposes even though it adds no semantic information; it also provides
clues for application programmers.

ENTITY-
RELATIONSHIP An example of this can be : Age can be derived from the attribute Birthdate
In this situation, Birthdate is called a stored attribute, which is physically saved to the
MODEL database.
Entity Relationship Diagram

The types of attributes

Unstable attributes - This type of


DATABASE attribute have values that always
DESIGN: change. For example, the salary of
ENTITY- employee.
RELATIONSHIP
MODEL
Mandatory attributes - Mandatory
attributes must have a value. For
example, in most businesses that
track personal information, Name is
required.
Entity Relationship Diagram
The types of attributes

Optional attributes - Optional attributes may


have a value or be left null; For example, address of
DATABASE employee
DESIGN:
ENTITY-
RELATIONSHIP Unique identifier - This type of attribute
MODEL distinguishes one entity from another.

For example, in a company, you can distinguish


between one employee and another using a
EmployeeID.
Entity Relationship Diagram

4. Link between attribute and entity


set
DATABASE Lines represent linking of
DESIGN: attributes (properties) to entity
ENTITY- sets.
RELATIONSHIP
MODEL

You might also like