Professional Documents
Culture Documents
Management
Content
Organizing Data
Designing Databases using Entity
Relationship Diagrams
Identifying Keys in Tables
Using MySQL Tools
Querying Databases
Organizing Data
Data Storage in a Computerized System
For your business to be successful, fast access to
information is critical. You extract information from
existing data. Important decisions are based on the
information available to any point in time.
In order to get the right information at the right time;
you can store data about the business on a computer
system. This aids in fast access to the information.
Besides enabling data access, a computerized
system also helps you to manage data efficiently.
Managing data involves storing, organizing, modifying
and deleting data.
Organizing Data
Concept of a Database
A database is a collection of data. Two of your
major tasks, while using a computer system,
are to store and manage data.
To handle these tasks, you need a
specialized computer program known as a
Relational Database Management System
(RDBMS)
Organizing Data
Some popular RDBMS are:
MicrosoftSQL Server
Oracle Server
Sybase
Informix
Postgres
MySQL
Organizing Data
In order to identify the data items that
needs to be stored; let us understand what
entities and attributes are.
Entity
The basic data item stored in a database is
called an entity.
An entity can be any object, item, place,
person, concept, or activity about which data
can be stored.
Organizing Data
Entity
An entity is an object with a distinct set of
easily identifiable properties.
Entities are building blocks of the database,
Some exampled of entities are a product, a
student, a book, an author, a teacher, or an
applicant.
Organizing Data
Guidelines for Identifying an Entity
Identify the larger blocks in a scenario about
which data has to be stored.
Identify the nouns in a problem statement.
Organizing Data
Attribute
An attribute is a property of an entity. It
describes a part of the entity.
An entity could have 1 or more attributes.
For example, some of the attributes of an
entity Product are ProductName, Price,
ExpiryDate
Organizing Data
Guidelines for Identifying an Attribute
Ina problem scenario, you may treat nouns
that describe the entity, as attributes.
Organizing Data
Tables
Data in an RDBMS is represented in the
forms of tables.
You represent an entity in the form of a table
in the database.
A table is a set of rows and columns.
You represent the attributes of the entity as
column headings and the actual data about
the entity in rows.
Organizing Data
Tables Table Name
Attribute Names
Organizing Data
Tables
Attribute Names
Records/
Rows
Student Course
Designing Databases using Entity
Relationship Diagrams
Attributes
StudentId StudentName
Student
Designing Databases using Entity
Relationship Diagrams
Relationships
1 1
Student Does Project
Designing Databases using Entity
Relationship Diagrams
One-to-Many Relationship (1:m)
1 m
Department Has Employees
Designing Databases using Entity
Relationship Diagrams
Many-to-Many Relationship (m:m)
m m
Customer Purchases Products
Designing Databases using Entity
Relationship Diagrams
Deriving Tables From an ER Diagram for a
Database Structure
One-to-One Relationship (1:1)
1 1
Student Does Project
Designing Databases using Entity
Relationship Diagrams
One-to-Many Relationship (1:m)
1 m
Department Has Employees
Designing Databases using Entity
Relationship Diagrams
Many-to-Many Relationship (m:m)
m m
Customer Purchases Products
Identifying Keys in Table
Entity Integrity
Identifying Keys in Table
Entity Integrity
Ensures that each row can be uniquely
identified by an attribute called the primary
key.
The primary key cannot be null.
It is recommended that the data in the primary
key column be short.
Identifying Keys in Table
Entity Integrity
Identifying Keys in Table
Entity Integrity
Identifying Keys in Table
Composite Key
When the key that uniquely identifies the rows
of the table is made up of more than one
attribute, it is called a composite key.
Identifying Keys in Table
Referential Integrity
Ensuring that all values in the foreign key
match with the primary key values.
Foreign Key
Two tables can be related using a common
attribute.
When a primary key of one table is also
available as an attribute in another related
table, it is called a Foreign Key
Identifying Keys in Table
Using MySQL Tools