ICTMC Fundamentals of Database
ICTMC Fundamentals of Database
OF DATABASE
ADMINISTRATION
2
FAQ
What is it?
Why do we need it?
How does it work?
This lecture is designed to provide an initial and
fundamental knowledge in Database Administration
concepts, advantages of database automation, types
of database , data types and attributes,
Normalization Concept this will also introduce
MYSQL Database, Data Manipulation Language,
Data Definition Language and Database Constraints.
Fundamentals of Database Administration with MYSQL 4
LEARNING OUTCOMES
PART I
DATABASE
MANAGEMENT
SYSTEM CONCEPT
Fundamentals of Database Administration with MYSQL 6
Fundamentals of Database Administration with MYSQL 7
Fundamentals of Database Administration with MYSQL 8
• Unorganized
• Unstructured
• Inefficient
• Chaotic
Fundamentals of Database Administration with MYSQL 9
Fundamentals of Database Administration with MYSQL 10
Fundamentals of Database Administration with MYSQL 11
• Organized
• Structured
• Efficient
• Neat
Fundamentals of Database Administration with MYSQL 12
WHAT IS DATABASE
A database is an organized collection
of structured information, or data,
typically stored electronically in a
computer system. A database is
usually controlled by a database
management system (DBMS).
Fundamentals of Database Administration with MYSQL 13
DATABASE
• Different Category of files
• Different types of reports
Fundamentals of Database Administration with MYSQL 14
HISTORY
Computerized databases started in the
1960s by Charles W Bachman, when
the use of computers became a more
cost-effective option for private
organizations. The history of
computers and databases are
interlinked. As prices dropped it
became easier to shift data storage
and databases to computers.
Fundamentals of Database Administration with MYSQL 15
HISTORY
There were two popular data models in
this decade: a network model called
CODASYL and a hierarchical model
called IMS. One database system that
proved to be a commercial success
was the SABRE system that was used
by IBM to help American Airlines
manage its reservations data.
Fundamentals of Database Administration with MYSQL 16
SABRE SYSTEM
Fundamentals of Database Administration with MYSQL 17
4 TYPES OF DATABASE
MANAGEMENT SYSTEM
• Relational Database(RDBMS)
• Hierarchical Database Model
• Network Database Model
• Object Oriented Database
Fundamentals of Database Administration with MYSQL 18
Key Characteristics:
•Tree-like structure: Data is stored in a hierarchical
arrangement, with each record having a single parent and
multiple children.
•One-to-many relationships: A parent record can have
multiple child records, but a child record can only have one
parent.
•Limited flexibility: The hierarchical model is not well-
suited for complex relationships or large-scale data storage.
•Efficient for certain types of data: Hierarchical databases
are efficient for storing and retrieving data with a natural
hierarchical structure, such as file systems, organizational
charts, or network topology analysis.
Fundamentals of Database Administration with MYSQL 20
Advantages:
•Fast data retrieval: Hierarchical databases allow for efficient
retrieval of data, as the tree-like structure enables quick
navigation to specific records.
•Simple data relationships: The one-to-many relationships in a
hierarchical database make it easy to understand and manage
data relationships.
Disadvantages:
•Limited scalability: Hierarchical databases can become
cumbersome and inefficient as the data grows in size or
complexity.
•Limited flexibility: The rigid tree-like structure makes it
difficult to accommodate changes or additions to the data
model.
Fundamentals of Database Administration with MYSQL 21
Use Cases:
•File systems: Hierarchical databases are well-suited for storing
and managing file systems, where files are organized in a tree-
like structure.
•Organizational structures: Hierarchical databases can be used
to store and manage organizational charts, where employees
are arranged in a hierarchical structure.
•Network topology analysis: Hierarchical databases can be
used to analyze and store network topology data, where
devices are connected in a hierarchical structure.
Fundamentals of Database Administration with MYSQL 22
Key Features:
1.Graph Structure: The network model represents data as a
graph, where nodes (records) are connected by edges
(relationships).
2.Many-to-Many Relationships: Each record can have
multiple parent and child records, forming a generalized graph
structure.
3.Schema: The schema is viewed as a graph, where
relationship types are arcs and object types are nodes.
4.Flexible: The network model is more flexible than the
hierarchical model, allowing for complex relationships and
navigational access.
5.Complex Query Performance: Graph databases optimized
for network models can deliver fast query responses for
complex relationship-based queries.
Fundamentals of Database Administration with MYSQL 24
Advantages:
1.Efficient Query Performance: The network model excels in
handling relationships, making it suitable for applications that
require frequent traversals of relationships.
2.Scalability: While network data models can degrade in
performance with large datasets or complex graphs, scaling
strategies can be employed to maintain query performance.
Fundamentals of Database Administration with MYSQL 25
Disadvantages:
1.Complexity: The network model’s graph structure can be
complex to design and implement.
2.Data Integrity: Ensuring data integrity can be challenging
due to the flexibility of the model.
3.Lack of Standardization: The network model lacks a
standardized implementation, making it difficult to integrate
with other systems.
Fundamentals of Database Administration with MYSQL 26
Use Cases:
1.Telecommunications Networks: The network model is well-
suited for modeling complex relationships between network
nodes and edges.
2.Inventory Management: The model can efficiently handle
relationships between items, suppliers, and customers.
3.Social Networks: The network model represents individuals
as nodes, and connections between them (e.g., friendship,
family, professional relationships) as edges.
Fundamentals of Database Administration with MYSQL 27
Key Characteristics:
1.Objects: Data is stored as self-contained objects, each with
its own set of attributes (data) and methods (procedures).
2.Classes: Objects are instances of classes, which define the
structure and behavior of objects.
3.Inheritance: Classes can inherit properties and behavior
from parent classes, allowing for a hierarchical organization
of data.
4.Polymorphism: Objects of different classes can be treated
as if they were of the same class, enabling generic
operations.
5.Encapsulation: Objects hide their internal implementation
details and expose only necessary information to the outside
world.
Fundamentals of Database Administration with MYSQL 29
Advantages:
1.Improved data modeling: OOM allows for more accurate
representation of real-world entities and their relationships.
2.Increased flexibility: Objects can be easily modified or
extended without affecting other parts of the database.
3.Better support for complex domains: OOM is well-suited
for domains with complex relationships and behaviors.
Fundamentals of Database Administration with MYSQL 30
Challenges:
1.Steep learning curve: Developers need to understand OOP
concepts and how they apply to databases.
2.Performance: OOM can be slower than traditional
relational databases due to the overhead of object creation
and method invocation.
3.Scalability: OOM can be more challenging to scale
horizontally (add more machines) due to the complexity of
object relationships.
Fundamentals of Database Administration with MYSQL 31
Examples:
1.ObjectDB: A Java-based Object-Oriented Database
Management System (OODBMS) that provides transparent
persistence for Java objects.
2.Object-relational Data Model: A combination of Object-
Oriented and Relational database models, which supports
both object-oriented and relational data structures.
Fundamentals of Database Administration with MYSQL 32
Key Concepts:
•Relations: Tables that store data, with each row representing
an entity and each column representing a property or
attribute.
•Tuples: Individual rows in a relation, containing values for
each attribute.
•Schema: The overall structure of the relations, including the
relationships between them.
•Primary keys: Unique identifiers for each tuple in a relation,
ensuring data integrity and enabling joins between relations.
•Foreign keys: References to primary keys in other relations,
establishing relationships between them.
Fundamentals of Database Administration with MYSQL 34
Benefits:
•Data normalization: Reducing data redundancy and
improving data integrity by storing each piece of data in one
place.
•Improved query performance: Allowing for efficient querying
and joining of data across multiple relations.
Fundamentals of Database Administration with MYSQL 35
Fundamentals of Database Administration with MYSQL 36
MongoDB
Fundamentals of Database Administration with MYSQL 39
RELATIONAL DATABASE
MS SQL Server
MySQL
MariaDB
SQLite
PostgreSQL
Fundamentals of Database Administration with MYSQL 41
TYPES OF RELATIONSHIPS
• one to one
• one to many
• many to one
• many to many
Fundamentals of Database Administration with MYSQL 42
ONE TO ONE
ONE TO MANY
MANY TO ONE
MANY TO MANY
DATABASE TERMS
Database
Table
Records
Fundamentals of Database Administration with MYSQL 51
DATATYPE
COMMON DATATYPES
Database Administration
54
Database Administration
55
Database Administration
Fundamentals of Database Administration with MYSQL 56
CONSTRAINTS
CONSTRAINTS
Fundamentals of Database Administration with MYSQL 58
PART 2
CHARACTERSET
AND COLLATION
Fundamentals of Database Administration with MYSQL 63
CHARACTERSET
ABC etc..
123 etc..
COLLATION
For Server
We configure the content of my.cnf in your
Database server.
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4
Collation-server=utf8mb4_unicode_ci
[mysql]
default-character-set=utf8mb4
Fundamentals of Database Administration with MYSQL 68
PART 3
DATABASE
NORMALIZATION
Fundamentals of Database Administration with MYSQL 72
Normalization
Database Normalization is the process of
Organizing data into tables in such a way
That the results of using the database
Are always unambiguous and as intended
Fundamentals of Database Administration with MYSQL 73
Unnormalize Data
Fundamentals of Database Administration with MYSQL 74
Normalize Data
Fundamentals of Database Administration with MYSQL 75
1NF
2NF
3NF
4NF
5NF
Fundamentals of Database Administration with MYSQL 77
Person1 Person1 29
Person2 Person2 31
Person3 Person3 26
Person4 Person4 24
Fundamentals of Database Administration with MYSQL 79
Person1 29
Person3 26
Person4 24
Fundamentals of Database Administration with MYSQL 80
1. Deletion Anomaly
2. Update Anomaly
3. Insertion Anomaly
Fundamentals of Database Administration with MYSQL 87
Identify the
Rating of the player
Fundamentals of Database Administration with MYSQL 88
Theres a new beginner player name india19 however it is not allowed Insertion Anomaly
to insert because it has no item yet
Fundamentals of Database Administration with MYSQL 89
4
Presentation title 91
Fundamentals of Database Administration with MYSQL 92
PART 4
DATABASE
CREATION USING
MYSQL
Fundamentals of Database Administration with MYSQL 97
SOFTWARE INSTALLATION
Database Server
mysql-server
mysql-client
Enable firewall
Fundamentals of Database Administration with MYSQL 98
WHY MYSQL
MySQL allows developers to use
binaries to manipulate database files
even while running. Database files can
also be accessed and manipulated by
alternative processes at runtime.
Conversely, MSSQL doesn't allow any
process to manipulate or access
binaries or database files.
Fundamentals of Database Administration with MYSQL 99
WHY MYSQL
MySQL is an open-source relational
database management system
(RDBMS), while MSSQL Server is a
Microsoft-developed RDBMS.
Fundamentals of Database Administration with MYSQL 100
WHY MYSQL
Fundamentals of Database Administration with MYSQL 101
Activity:
2. If you access the server successfully open your mysql database account
Using the command below:
Example:
If your fullname is Juan J Dela Cruz your username is
delacruz_jj and the passcode is djj@ictmc
To display the list of database under your account just type the following
below:
show databases;
Database Fundamentals 107
Syntax:
use [database_name];
Note: mysql database name and tables is case sensitive
Activity: create a table with 5 records each using the database schema
below:
Table: users
Table: orders
Database Fundamentals 110
Table: products
Inset record
Syntax: (note if the field use character data type the value to be encode
must be enclosed using double quote “”
Display record
To display the table record use select command:
To display single column just specify the column name after the select
command.
Database Fundamentals 113
“%n” displays all the record of first_name column that ends with letter “n”
“%n%” displays all the record of first_name column with letter “n”
Database Fundamentals 114
To Update record
Use “UPDATE” To update existing record.
To update record: (note use a unique reference for the where clause)
To CONCAT record
Use “CONCAT” To concat existing record.
lcase()
ucase()
avg()
max()
min()
count()
Presentation title 120
To Delete record
Use “DELETE” To Delete existing record.
To Delete record: (note use a unique reference for the where clause)