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

5.2 Structured Data

Here are the key elements identified in the ER diagram: 1. Entities: - Student - Course 2. Attributes: - Student ID, Name (attributes of Student entity) - Course ID, Title (attributes of Course entity) 3. Relationship: - Enrolled (relationship between Student and Course entities) B. This ER diagram models the relationship between students and courses. It shows: - Student and Course are the two entities - Student has attributes - Student ID and Name - Course has attributes - Course ID and Title - There is a many-to-many relationship between Student and Course called "Enrolled" - This relationship shows that a student can

Uploaded by

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

5.2 Structured Data

Here are the key elements identified in the ER diagram: 1. Entities: - Student - Course 2. Attributes: - Student ID, Name (attributes of Student entity) - Course ID, Title (attributes of Course entity) 3. Relationship: - Enrolled (relationship between Student and Course entities) B. This ER diagram models the relationship between students and courses. It shows: - Student and Course are the two entities - Student has attributes - Student ID and Name - Course has attributes - Course ID and Title - There is a many-to-many relationship between Student and Course called "Enrolled" - This relationship shows that a student can

Uploaded by

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

5.

2 STRUCTURED DATA
Prepared by: Mohammad Nabeel Arshad
• Structured data is data that has been organized into a formatted repository,
typically a database, so that its elements can be made addressable for
more effective processing and analysis.

• A data structure is a kind of repository that organizes information for that


purpose.

• Structured data refers to any data that resides in a fixed field within a record
or file. This includes data contained in relational databases and
spreadsheets.

• Examples of structured data include numbers, dates, and groups of words


and numbers called strings. ... Structured data is the data you're probably
used to dealing with. It's usually stored in a database.
5.2.1 PURPOSE OF A DATABASE
• A database is used to collect and organize data. The purpose of a
database is to store and retrieve information in a way that is accurate and
effective.

• A database can simply be a list that is kept written or typed on paper, in a


computer spreadsheet or word processing document. This type of database,
called a flat file, consists of one table with rows and columns of data.

• For example, a simple database for a small business might contain only two
columns, product name, or brand and price. If a customer calls to ask about
pricing, the store employee scans down the first column to find the product
and then looks at the associated price column to answer the customer's
question.
5.2.2 PURPOSE OF A RELATIONAL
DATABASE
• A relational database is a collection of data items organized as a set of
formally-described tables from which data can be accessed or reassembled
in many different ways without having to reorganize the database tables.

• In a relational database, all data are stored and accessed via relations.
Relations that store data are called "base relations", and in implementations
are called "tables". Other relations do not store data, but are computed by
applying relational operations to other relations.
A relational database is one that offers extremely complex and sophisticated
queries and searches, thanks to two factors:
tables and cross-referencing.
It stores data as tables rather than plain lists, making it easier to filter individual
elements of each record. It also allows cross-referencing between different
sets of data.

Relational database is used mainly for:


• Data redundancy
• Data integrity
• Inconsistency can be avoided
• Data can be shared
• Restriction for unique
• Provide backup
The main characteristics of a relational database are:
• it is built from a set of unique tables (also called relations)
• a table contains data about just one entity
• tables must have a primary key
• tables are linked by primary and foreign keys
BENEFITS OF RELATIONAL DATABASE
The advantages of Relational database are:
• No multiple record changes needed
• More efficient storage
• Simple to delete or modify details.
• All records in other tables having a link to that entry will show the change.
• Avoids data duplication
• Avoids inconsistent records
• Easier to change data
• Easier to change data format
• Data can be added and removed easily
• Easier to maintain security.
Elements of A Table
contains a set of records. You set up relationships between these in order to create a relational
Table
database.

Field a single piece of data about one person or one thing. Many of these make up a record.

Record all of the data about one person or one thing. This is made up of one or more 'fields'.

describes the characteristics of an object. For example, House number - address / surname -
Attribute (Field)
person.

Primary Key A field within a database which enables every record to be uniquely identified.

two fields in different tables depend on one another. For example, a foreign key in one table will
Relationship (Link)
be the primary key in another table, so when one changes the other must change as well.

a field in a relational table that matches a primary key of another table. It can be used to cross-
Foreign Key
reference tables.

Composite Key consists of more than one attribute to uniquely identify an entity occurrence.
5.2.3 ENTITIES AND THE
RELATIONSHIPS BETWEEN THEM

• The entity relationship (ER) data model 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.

ER modelling is based on two concepts:


• Entities, defined as tables that hold specific information (data)
• Relationships, defined as the associations or interactions between entities
• An ER diagram has three main components:
1. Entity
2. Attribute
3. Relationship

• An entity is any object in the system that we want to model and store
information about. Entities are usually recognizable concepts, either
concrete or abstract, such as person, places, things, or events which have
relevance to the database. Some specific examples of entities are
Employee, Student, Lecturer.
• Attribute
An attribute describes the property of an entity. An attribute is represented as Oval in
an ER diagram. There are four types of attributes:

1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute

• 1. Key attribute:
A key attribute can uniquely identify an entity from an entity set. For example, student
roll number can uniquely identify a student from a set of students. Key attribute is
represented by oval same as other attributes however the text of key attribute is
underlined.
• ER diagram key attribute
2. Composite attribute:
An attribute that is a combination of other attributes is known as composite attribute. For example, In
student entity, the student address is a composite attribute as an address is composed of other
attributes such as pin code, state, country.
ER diagram composite attribute

3. Multivalued attribute:
An attribute that can hold multiple values is known as multivalued attribute. It is represented with
double ovals in an ER Diagram. For example – A person can have more than one phone numbers so
the phone number attribute is multivalued.

4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another attribute. It is represented
by dashed oval in an ER Diagram. For example – Person age is a derived attribute as it changes over
time and can be derived from another attribute (Date of birth).

E-R diagram with multivalued and derived attributes:


Multivalued and derived attribute
3. Relationship
• A relationship is represented by diamond shape in ER diagram, it shows the
relationship among entities. There are four types of relationships:
• 1. One to One
• 2. One to Many
• 3. Many to One
• 4. Many to Many
Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets

to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set


Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set


• A simple ER diagram showing Entity, Attribute and Relationship
5.2.4 CREATE ENTITY RELATIONSHIP DIAGRAMS

Normalization is the process of organizing


data in a database. This includes creating
tables and establishing relationships
between those tables according to rules
designed both to protect the data and to
make the database more flexible by
eliminating redundancy and inconsistent
dependency.
Entity Relationship (ER) modeling
• is a design tool
• is a graphical representation of the database system
• provides a high-level conceptual data model
• supports the user’s perception of the data
• is DBMS and hardware independent
• had many variants
• is composed of entities, attributes, and relationships
MAKING ERD
• An Entity-Relationship diagram is hugely important in database design and
should be the first thing you draw when contemplating database
architecture. ERDs are used for describing data and the rules determining
how entities and attributes interact with each other.

For making an ERD diagram firstly Identify the components:


1. Determine the entities: Entities are typically nouns such as car, bank,
student, or product.
2. Identify the relationships: Relationships highlight how entities interact with
each other.
3. Add attributes: Attributes show specific characteristics of an entity, refining
what information is important to the model.
4. Complete the diagram
FOR CUSTOMERS, SALES AND PRODUCTS
If we do this for the other relationships too, we'll get:
• Customers --> Sales; --> 1:N
• Customers --> Products; --> M:N
• Customers --> Shops; --> M:N
• Sales --> Products; --> M:N
• Shops --> Sales; --> 1:N
• Shops --> Products; --> M:N

Entity relationship model


ER diagram showing students enrolled in Coursed
A. In the above ER diagram identify the B. Explain the above ER Diagram. How
following: entities and attributes are linked.
i. Entity
ii. Attributes
iii. Relationships
Home work

• Design an ER Diagram showing Employee and Project.

You might also like