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

IM Week2 Lesson1

Uploaded by

jamesawo688
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

IM Week2 Lesson1

Uploaded by

jamesawo688
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

ICC223 INFORMATION MANAGEMENT

Lesson 01: Introduction to Databases

Databases are integral to modern computing, serving as organized collections of data that can be easily
accessed, managed, and updated. In this section, we'll explore the fundamentals of databases, focusing on
MySQL, one of the most popular database management systems (DBMS). By definition Database is simply a
structured collection of data.

Understanding the Database


A database is a collection of data that computers can access. The data is organized in a way that makes it
easy to find and use.
Databases are used to store data in a variety of formats, including text, images, and numbers. They can be
used to store data in a structured way, such as a customer database, or in an unstructured way, such as a document
database.
Databases can be used for various purposes, such as storing data for a website, keeping track of customer
information, or managing inventory.
A database is often controlled by a database management system (DBMS). In the database, you must
recognize the data processing. Data processing is data collection, organization, analysis, and presentation. It
involves various activities to summarize data to produce meaningful information. Data processing systems can
range from simple to complex, depending on the type and quantity of data that needs to be processed.

What is MySQL
MySQL is an open-source relational database management system (RDBMS) that uses Structured Query
Language (SQL) to manage data. It's widely used for web applications and is known for its reliability, scalability,
and ease of use.

● MySQL got its name from the daughter of one of its co-founders, Monty Widenius, whose name is My.
Combining ‘My’ with ‘SQL,’ we get MySQL.
● MySQL is a durable database management system designed for managing relational databases. It is open-
source software supported by Oracle, meaning that you can use MySQL without any cost. Additionally,
you will have the flexibility to modify its source code to tailor it to your specific requirements.
● Despite being open-source software, you also have the option to purchase a commercial license from
Oracle, which provides access to premium support services.
● When compared to other database software like Oracle Database or Microsoft SQL Server, MySQL is
relatively easy to master.
● MySQL is versatile and can run on various platforms, including UNIX, Linux, and Windows. You can
install it on a server or even on a desktop. What’s more, MySQL is renowned for its reliability, scalability,
and speed.
The data within a database are naturally related, for example, a product belongs to a product category and
is associated with multiple tags. Hence, we use the term relational database.
In a relational database, we model data like products, categories, tags, etc., using tables. A table contains
columns and rows, much like a spreadsheet.
Tables can relate to one another table using various types of relationships, like one-to-one and one-to-
many.
Because we handle a substantial amount of data, we need a way to efficiently define databases, tables, and
process data. Moreover, we want to transform data into valuable information.

● SQL is the language of the relational database


● SQL stands for the structured query language.
● SQL is the standardized language used to access the database.

SQL is composed of three parts:

1. Data definition language (DDL) includes statements for defining the database and its objects such as
tables, views, triggers, stored procedures, etc.
2. Data manipulation language (DML) contains statements for updating and querying data.
3. Data control language (DCL) allows you to grant permissions to users to access specific data in the
database.

Connect to MySQL Using mysql command-line client


The mysql is a command-line client program that allows you to interact with MySQL in interactive and
non-interactive modes.
The mysql command-line client is typically located in the bin directory of MySQL’s installation directory
such as C:\Program Files\MySQL\MySQL Server 8.0\bin on Windows. To invoke the mysql program, you open
the Command Prompt on Windows or Termina on Unix-like systems and navigate to the bin directory of the
MySQL installation directory:

C:\Program Files\MySQL\MySQL Server 8.0\bin>

The Command Prompt is a command-line interpreter program available in Windows. The Command
Prompt program allows you to interact with the computer through text-based commands for tasks like running
programs, managing files, and configuring system settings.
If the bin directory is included in the PATH, you can use the mysql command from the Command Prompt without
the need to navigate to the bin directory.

On Windows, the PATH is an environment variable that contains a list of directories. Windows OS uses these
directories to locate executable files, making it easier to run applications from the Command Prompt without
specifying the full file path.

To connect to the MySQL Server, you type this command on Command Prompt:
mysql -u root -p

In this command:
-u root means that you connect to the MySQL Server using the user root.
-p instructs mysql to prompt for a password.

You type the password for the root user and press Enter:
Enter password: ********

If everything is OK, you will connect to the MySQL Server and see the following command:
mysql>

To display available databases in the current server, you enter the SHOW DATABASES statement terminated
by a semicolon (;) and press the Enter key:
show databases;

The mysql program will return the following output:


+----------------------------------+
| Database |
+----------------------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+---------------------------------+
4 rows in set (0.01 sec)

Here are the steps that occur behind the scenes:

● First, the mysql command-line client sends the query to the MySQL Server.
● Second, the MySQL server executes the query and sends the result back.
● Third, the mysql command-line client displays the result.

How to Load the Sample Database into MySQL Server


Summary: in this tutorial, you will learn how to load the sample database into your MySQL Server using the
mysql program.

Step 1
Download the classicmodels database attached on our google classroom.

Step 2
Unzip the downloaded file into a temporary directory. You can use any directory you prefer, for example, C:\temp
directory.

Step 3
Connect to the MySQL server using the mysql client program:
mysql -u root -p

In this command:
mysql: This is the command to start the MySQL client, which allows you to connect to interact with databases.
-u root: This specifies the user that you want to connect to the MySQL database server. In this case, it is the root
user that has full administrative privileges.
-p: This flag will prompt you to enter the password for the root user after you execute the command.

You’ll be asked to enter the password for the root user. Note that the password for the root user is the one that
you set when you installed MySQL.
Enter password: ********
After a successful login, you’ll see the prompt that looks like this:
mysql>

Step 4
Use the source command to load data into the MySQL Server:
source c:/temp/mysqlsampledatabase.sql

Step 5
Use the SHOW DATABASES command to list all databases in the current server:
show databases;

The output will look like the following including the newly created classicmodels database:
+----------------------------------+
| Database |
+----------------------------------+
| classicmodels |
| information_schema |
| mysql |
| performance_schema |
| sys |
+----------------------------------+
Data is information that has been collected and organized in a structured format. It can be numerical, text-
based, or images and is used to analyze patterns and trends, make decisions, and develop strategies. Data is a set
of values typically organized in a specific way. In most cases, data is collected into a table, with each row
representing a different data point and each column representing a separate data category. Data can answer
questions, solve problems, or provide information. Sometimes, data is used to make predictions or find trends.
And the data in a database can be divided into two main categories: static and dynamic.

● Static data is data that does not often change, such as a list of countries or products.
● Dynamic data is data that frequently changes, such as a list of customers or a list of orders.

What is DBMS?
A database management system (DBMS) allows users to store, retrieve, and manipulate data in a database.
A DBMS typically provides tools that enable users to create, update, and delete data in the database. In addition,
a DBMS may provide tools for managing the database, such as creating and deleting tables and indexes and
managing user access to the database. It also includes data security, data integrity, and data recovery features.

Types of DBMS
There are four main types of DBMS: relational, object-oriented, graph-based, and NoSQL.

● Relational DBMSs are the most common and use a tabular structure to store data.
● Object-oriented DBMSs use an object-oriented model to store data, and Graph-based DBMSs use a graph
structure to store data.
● NoSQL DBMSs are a newer DBMS type that uses a non-tabular structure to store data.
There are some other types of DBMS also considerable one, and there are,

● Hierarchical DBMS
● Network DBMS
● Cloud DBMS
● In-Memory DBMS
● Distributed DBMS
● Multivalue DBMS
● XML DBMS
Type of DBMS Description Examples
Relational DBMS A type of DBMS that organizes data into tables (also MySQL, Oracle, and
(RDBMS) known as relations) and allows for the creation of Microsoft SQL
relationships between them. Server
Object-oriented A type of DBMS that organizes data into objects and MongoDB and
DBMS allows for the creation of classes and inheritance. Apache Cassandra
(OODBMS)
Hierarchical A type of DBMS that organizes data into a tree-like IBM’s Information
DBMS (HDBMS) structure, with each record having a single parent and Management
zero or more children. System (IMS)
Network DBMS A type of DBMS that organizes data into a network- Integrated Data
(NDBMS) like structure, with multiple parents and children for Store (IDS)
each record.
NoSQL DBMS A type of DBMS that does not use the traditional MongoDB,
table-based structure of RDBMS. Instead, it uses a Cassandra, Redis
more flexible, document-based or key-value-based and Couchbase
data model.
Document- A type of NoSQL DBMS that organizes data into MongoDB and
oriented DBMS documents, similar to JSON or XML, and is often used Couchbase
for unstructured or semi-structured data.
Column-family A type of NoSQL DBMS that organizes data into Apache Hbase and
DBMS columns rather than rows, and is optimized for Google BigTable
handling large amounts of data.
Key-value A type of NoSQL DBMS that store data as a mapping Redis and Riak
databases of keys to values and are optimized for high-speed
data retrieval.
Graph DBMS A type of NoSQL DBMS that organizes data in the Neo4j and Amazon
form of nodes and edges, and is optimized for Neptune
handling relationships between data.
In-memory A type of DBMS that stores all data in the memory SAP HANA and
DBMS (RAM) rather than in disk storage. This allows for Apache Ignite
faster data access and is commonly used for real-time
data processing or high-performance computing.
Time-series A type of DBMS that is optimized for handling time- InfluxDB and
DBMS series data, which is data collected at regular intervals TimescaleDB
over time.

Benefits of DBMS
A database management system (DBMS) is a software package designed to define, manipulate, and
control a database. It is a system that enables the creation and maintenance of a central database. So, there are
plenty of benefits of this DBMS, and the following are the considerable ones,

● Data Integrity: A DBMS helps maintain data integrity due to its ability to enforce data integrity constraints.
This integrity ensures that data is consistent, accurate, and reliable over time.
● Data Security: A DBMS ensures data security through access control mechanisms like user profiles,
passwords, and other authentication methods. This security ensures that only authorized users have access
to the required data.
● Data Redundancy: A DBMS eliminates data redundancy by storing data in a single centralized location.
And this redundancy reduces the amount of data that needs to be stored and simplifies the data
manipulation process.
● Data Consistency: A DBMS ensures data consistency by enforcing data rules and constraints. More than
this, this consistency ensures that all users have access to the same up-to-date information.
● Cost Reduction: A DBMS system reduces the cost associated with data storage and data management.

What is RDBMS?
Generally, RDBMS stands for “relational database management system.” A relational database
management system (RDBMS) is a database management system (DBMS) that uses relational techniques for
storing and retrieving data. And also, it is based on the relational model, which organizes data into rows and
columns in tables.
RDBMS use SQL (Structured Query Language) to manipulate data in the database. SQL is a standard
language that most RDBMSs use and SQL can insert, update, delete, and query data in the database. RDBMSs
have been the most popular type of DBMS since the 1980s. And nowadays, RDBMS are the most widely used
database systems because they provide a powerful and flexible way to store, retrieve and manage data.
Features of RDBMS
One of the key features of an RDBMS is the use of a primary key and foreign keys to establish
relationships between tables. A primary key is a unique identifier for each record in a table, and a foreign key is
a reference to the primary key of another table. This allows for the creation of relationships between tables, such
as one-to-one, one-to-many, and many-to-many.

Examples of RDBMS
RDBMSs are widely used in many different industries, from small businesses to large enterprise systems.
Some popular examples of RDBMSs include MySQL, Oracle, and Microsoft SQL Server. They are well suited
for structured data and support SQL (Structured Query Language) which is a standard language for interacting
with relational databases.
RDBMSs provides a lot of functionality like ACID properties (Atomicity, Consistency, Isolation,
Durability), Indexing, backup, recovery, security and many more.

Object-oriented DBMS (OODBMS)


An Object-oriented Database Management System (OODBMS) is a type of DBMS that organizes data
into objects and allows for the creation of classes and inheritance. In an OODBMS, data is stored in a format that
is similar to objects in object-oriented programming languages, such as Java or C++. Each object has its own
properties, methods, and behaviors, and can be part of a class or hierarchy of classes.
Features of OODBMS
One of the key features of an OODBMS is the ability to model complex relationships and hierarchies
within the data. For example, an OODBMS can model an object such as a car, which has properties such as make,
model, and year, and methods such as start and stop. It can also model relationships between objects, such as a
car having a one-to-many relationship with its parts.

Examples of OODBMS
OODBMSs are well suited for handling complex, unstructured, or semi-structured data, and are often used
in applications such as engineering, geographic information systems, and multimedia. Some popular examples of
OODBMSs include MongoDB, Apache Cassandra, and ObjectDB. They are not as popular as RDBMSs but still
have their use cases.
However, OODBMSs are not as standardized as RDBMSs, and the query languages and interfaces used
to interact with them can vary widely between different systems. Additionally, OODBMSs generally have less
support for ad-hoc queries, reporting, and analysis than RDBMSs.

Hierarchical DBMS (HDBMS)


A Hierarchical Database Management System (HDBMS) is a type of DBMS that organizes data in a
hierarchical tree-like structure. In an HDBMS, data is represented as a series of records, with each record having
one parent record and one or more child records. This creates a parent-child relationship between records, with
the parent record being at the top of the hierarchy and child records being at the bottom.
Features of HDBMS
The hierarchical model is closely related to the tree data structure, with the parent-child relationship being
similar to the parent-child relationship between nodes in a tree. The data is stored in a tree-like structure, with
each node representing a record and each branch representing a relationship between records. This structure
allows for easy traversal of data, but can make it more difficult to represent more complex relationships between
records.

Examples of HDBMS
HDBMSs were popular in the past, especially for applications such as data modeling for manufacturing
systems and other similar applications. IBM’s Information Management System (IMS) is an example of a
HDBMS. However, they have largely been replaced by more modern DBMSs, such as RDBMSs and OODBMSs,
which provide more flexibility and scalability.
HDBMSs are not as popular as RDBMSs or OODBMSs and are not used as much as they used to be.
They are not suitable for large and complex data sets, and are not very good at handling many-to-many
relationships between records. They are best suited for highly structured data and applications that require a high
level of data integrity and security.

Network DBMS (NDBMS)


A Network Database Management System (NDBMS) is a type of DBMS that organizes data in a network
structure. In a NDBMS, data is represented as a series of records, with each record having multiple parents and
children. This creates a many-to-many relationship between records, with records being connected to multiple
other records, creating a web-like structure.
The network model is closely related to the graph data structure, with the many-to-many relationship being
similar to the edges between nodes in a graph. The data is stored in a web-like structure, with each node
representing a record and each edge representing a relationship between records. This structure allows for easy
traversal of data, and can represent complex relationships between records.
NDBMSs were popular in the past and were used for applications such as data modeling for manufacturing
systems, inventory management, and other similar applications. Integrated Data Store (IDS) and Integrated Data
Store II (IDS II) developed by Integrated Data Systems (IDS) are examples of NDBMS. However, they have
largely been replaced by more modern DBMSs, such as RDBMSs and OODBMSs, which provide more flexibility
and scalability.
NDBMSs are not as popular as RDBMSs or OODBMSs and are not used as much as they used to be.
They are best suited for applications that require a high level of data integrity and security, and are not suitable
for large and complex data sets.

NoSQL DBMS
NoSQL (Not Only SQL) Database Management Systems (DBMS) refer to a type of DBMS that do not
use the traditional relational model and SQL (Structured Query Language) for data storage and retrieval. Instead,
they use alternative data models and query languages that are more suitable for handling large and unstructured
data sets, as well as for distributed and cloud-based environments.
NoSQL DBMSs are designed to handle big data and high-scale data processing workloads, they can handle
large volume, high velocity, and varied data. They are often used in web, mobile, gaming, and social media
applications, as well as in the Internet of Things (IoT), real-time analytics, and machine learning applications.

There are several different types of NoSQL databases. Some popular types of NoSQL databases include:

Document Database
Document databases, such as MongoDB and Couchbase, which store data in the form of documents and
allow for rich, nested data structures.

Column-Family Database
Column-family databases, such as Apache Cassandra and Hbase, which store data in the form of columns
rather than rows and are optimized for high read and write performance.
Key-Value Databases
Key-value databases, such as Redis and Riak, which store data as a mapping of keys to values and are
optimized for high-speed data retrieval.

Graph Databases
Graph databases, such as Neo4j and OrientDB, which store data as nodes and edges in a graph and are
optimized for traversing complex relationships.

NoSQL databases are more flexible and can handle unstructured data, which can be a great solution for
big data and real-time data-processing use cases. However, they lack the transactional guarantees and consistency
provided by RDBMSs and are not always suitable for complex queries, joins, and transactions.

In-memory DBMS
An In-memory Database Management System (DBMS) is a type of DBMS that stores all of its data in the
memory, as opposed to storing it on disk. This allows for faster data access and processing, since data does not
need to be read from disk and can be accessed directly from memory.
In-memory DBMSs are designed to handle real-time, high-concurrency, and high-throughput workloads.
They are often used in applications such as online transaction processing (OLTP), real-time analytics, and high-
frequency trading, where low latency and high performance are critical.

In-memory DBMS Benefits


In-memory databases use the same data models and query languages as traditional relational databases,
and can be used as a drop-in replacement for traditional databases in many cases. They can also be used in
conjunction with traditional databases, with the in-memory database being used as a cache or buffer for frequently
accessed data.

In-memory DBMS Limitations


In-memory databases can be very fast, but they have some limitations. The biggest limitation is their cost,
as they require large amounts of memory to store data, and memory is generally more expensive than disk storage.
Additionally, the amount of data that can be stored in memory is typically smaller than the amount that can be
stored on disk, so it may not be suitable for very large data sets.

Examples of In-memory DBMS


In-memory DBMSs are becoming more popular as the cost of memory has decreased and the need for
real-time data processing has increased. Some examples of in-memory databases are SAP HANA, Oracle
TimesTen, and IBM DB2 BLU.
Time-Series DBMS
A Time-Series Database Management System (DBMS) is a type of database that is specifically designed
to handle time-series data, which is a sequence of data points collected at regular intervals of time. This data
typically includes measurements such as temperature, pressure, humidity, stock prices, and so on, and it is usually
collected in real-time from various sources, such as sensors, IoT devices, and financial systems.

Features of Time-Series DBMS


Time-series DBMSs are designed to handle large amounts of data, high write and read rates, and complex
queries on time-based data. They typically provide features such as data compression, data retention policies, and
automatic downsampling, which are optimized for time-series data.

Examples of Time-Series DBMS


Time-series DBMSs are used in a wide range of applications, including monitoring and control systems,
industrial automation, financial analysis, and scientific research. Some examples of time-series databases are
InfluxDB, OpenTSDB, TimescaleDB and Prometheus.
They are often used in conjunction with other types of databases, like relational or NoSQL, to store the
metadata related to the time-series data, making it easier to search, query, and analyze the data.
Time-series databases can handle large amounts of data and support very fast queries and are optimized
for time-series data. However, they typically lack some of the features and functionality of traditional relational
databases, such as support for complex transactions and joins.

Benefits of RDBMS
A relational database management system (RDBMS) is a powerful tool for storing and retrieving data.
RDBMSs are used in various web-based applications, financial systems, and customer relationship management
(CRM) systems. RDBMSs are also well-suited for managing large volumes of data. RDBMS offer several benefits
over other database management systems.

● Structured Query Language (SQL): The most powerful benefit of RDBMS is the use of SQL to store,
retrieve, manipulate, and manage data. SQL is a powerful language that enables users to interact with the
database efficiently and effectively.
● Atomicity: This feature of RDBMS ensures that all the transactions in the system are completed in an
atomic manner. This means that all the transaction operations are done successfully, or none are done,
ensuring data integrity and consistency.
● Reliability: RDBMS provides a reliable system for storing, updating, and retrieving data. It also guarantees
data security since it maintains an audit trail of every transaction, which helps detect any anomalies in the
system.
● Scalability: RDBMS is highly scalable and can easily be expanded to accommodate larger datasets. And
this scalability leads to support for more users and data.
● Flexibility: RDBMSs offer a high degree of flexibility, allowing users to add, delete, and update data
easily.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy