What Is A Database

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 29

What is a Database?

A database is like a digital storage space


where related information is kept so you
can find and use it easily whenever
needed.
Database Management System
(DBMS)
A Database Management System
(DBMS) is a software tool used to create,
maintain, and access databases. Think of
it as a program that helps you manage
and organize all your data effectively.
Database Engine
The database engine is the part of the
DBMS that does the actual work. It stores
the data, retrieves it when asked, and
keeps things running smoothly in the
background.
Examples of DBMS Software
Some popular database management
software includes:
 Microsoft Access
 OpenOffice Base
 Corel Paradox
 Oracle Database

What Does a Database Contain?


A database is organized into several
parts:
1. Tables: These are the main
structures where data is stored. Each
table is like a folder that holds all
related information on one topic.
2. Fields (Columns): A field is a
single piece of data, like a name or
phone number. Each field is one
category of information that will be in
every record in the table.
3. Records (Rows): A record is a
collection of fields related to one item.
For example, one record might contain
all the information about a single
customer.
4. Primary Key: This is a unique
identifier for each record in a table. It
makes each entry unique so that it can
be easily found and referenced, like a
specific ID number for every customer.

Key People in Database Management


1. Database Designers: They
design how the database will be
structured, deciding what tables,
fields, and relationships are needed.
2. Database Developers: They
create the actual database, setting up
tables, fields, and organizing data as
the designers planned.
3. Database Programmers: They
write code to make the database
interact with other programs or to
create features for accessing the
database.
4. Database Administrators
(DBAs): They manage and oversee
the database, ensuring it runs
smoothly, backing up data, and
handling security.
5. Users: These are the people who
use the database daily, entering new
data, updating existing records, and
retrieving information when needed.

DBMS (Database Management


System): Good and Bad Points
Good Points
1. Less Repeated Data: We don’t
store the same data in lots of places.
2. Faster Searches: Makes it easy
and quick to find information.
3. Saves Space: Organizes data in a
way that doesn’t waste storage.
4. Easy to Keep Safe: Has features
to protect data better.
5. Fewer Errors: Helps keep data
accurate and reliable.
Disadvantages of Using a DBMS
1. Increased Vulnerability: Since all
data is stored in one central location,
there’s a higher risk if something goes
wrong, like a technical failure or cyber-
attack. Regular backups are essential
to protect against data loss.

File Management Systems vs. DBMS


 File Management Systems: In these
older systems, data is stored in
individual files without any links
between them. For example, you
might have separate files for
customers and orders, but they
wouldn’t be connected. This setup
leads to:
o More Redundancy: Same
information (like customer details)
might be stored in multiple places.
o Slower Access: Without
connections between files, it’s
harder and slower to find
information, especially if you need
data from multiple files.

How Data Is Organized in a Database


(Data Hierarchy)
1. Field: Holds one specific detail, like
a “Name” or “Age.”
2. Record: All the details about one
person or item (like a customer’s
name, phone number, and address).
3. Table: A list of related records (like
a list of all customers).
4. Database: A group of related
tables (like tables for customers,
products, orders, etc.).

Entities and Relationships


Entity
 An entity is a person, object, or event
that an organization needs to store
data about. Examples of entities
include “Customer,” “Product,” or
“Order.” Each entity generally
becomes a separate table in a
database.
 Entities have characteristics or
attributes, like “Name,” “Price,” or
“Date,” which describe the entity in
detail.

Attributes
 Attributes are the characteristics of an
entity. In a table, each attribute
becomes a field. For example, in a
“Customer” table, attributes might
include “Customer ID,” “Name,”
“Email,” and “Phone Number.”
Attributes define what data is stored
about each entity.

Relationships Between Entities


1. One-to-One (1:1) Relationship:
One entity is connected to only one
other entity. This is less common. For
example, a person may have one
passport, and each passport belongs
to only one person.
2. One-to-Many (1) Relationship:
This is the most common relationship
type, where one entity can be related
to multiple other entities. For example,
one customer can place multiple
orders, but each order belongs to only
one customer.
3. Many-to-Many (M)
Relationship: This type of
relationship occurs when multiple
entities are related to multiple other
entities. For example, students can
enroll in many courses, and each
course can have many students. This
relationship is often managed through
an additional table that links the two
entities.

Data Definition (Creating a Table)


When setting up a table, each field
(column) needs to be carefully defined.
This is called data definition and
involves specifying the properties for
each field. Here’s what you define for
each field:
1. Name: Each field must have a
unique name within the table, so it’s
clear what type of information it holds.
2. Data Type: This specifies the kind
of data the field will hold. Common
data types include:
o Text: For words or combinations of
letters and numbers.
o Number: For numerical values.
o Currency: For monetary values.
o Date/Time: For dates or
timestamps.
3. Description: An optional note
explaining what the field is for, helpful
for people working with the database.
4. Properties: Other settings for the
field, like:
o Size: How much data it can hold
(e.g., a text field might be limited
to 50 characters).
o Format: The specific appearance
of data (like date formats).

The Data Dictionary


A Data Dictionary is like a catalog or
guide for a database. It doesn’t hold the
actual data but contains essential
information (or metadata) about the
database. It includes:
1. Table Structures: Describes how
each table is organized.
2. Security Information: Includes
passwords and security settings.
3. Table Relationships: Shows how
different tables are connected.
4. Basic Table Information:
Includes things like the number of
records in each table.
The data dictionary helps maintain Data
Integrity, ensuring data is accurate and
consistent by enforcing rules and
standards.

Data Integrity
Data Integrity is about making sure the
data in the database is accurate,
complete, and reliable. Here’s how it’s
maintained:
 Data Accuracy: Good-quality data
entry is critical because accurate data
leads to useful information.
 Data Validation: This process
ensures only valid data can be
entered. For example:
o Record Validation Rules: Check
all fields before saving a record. If
one part is incorrect, the entire
transaction is rejected.
This validation ensures data entered
follows the rules, so errors are minimized.
Database Locking
Database Locking prevents two people
from changing the same data at the same
time. This lock makes sure data remains
consistent and avoids errors.
For example, if two people are editing the
same customer record, locking prevents
conflicting updates.

Data Security
Data Security protects the database
from unauthorized access, destruction, or
misuse. Key elements include:
1. Preventing Unauthorized
Access: Only approved users can
access the database.
2. Database Activity Monitoring:
Tracks and detects potential intrusions
or security risks.
3. Preventing Data Loss: Involves
regular backups and a disaster-
recovery plan, which allows for data
restoration if there’s a system failure
or attack.
Data Security is essential for both
internal (in-house) databases and cloud
databases.

Data Privacy
Data Privacy focuses on protecting
personal information stored in databases.
With so much personal data collected
today, breaches are a growing concern. In
fact:
 Some states require businesses to
inform customers if their data has
been compromised.
 Data breaches are costly, estimated at
about $200 per breached record.
Protecting personal data is essential to
build trust and avoid high costs
associated with data breaches.
o Allowable Range: Setting limits
on values (e.g., age can’t be
negative).
o Required Field: Whether the field
must be filled out or can be left
blank.

Column Databases
 Column Databases store data by
columns instead of rows.
o How It Works: Think of data for
each attribute (like “Name” or
“Age”) stored in a separate column,
rather than each individual record
(row) stored together.
o Benefits: Improves performance
by making data reading faster. It’s
especially useful for analyzing large
data sets in applications like data
warehouses and big data
processing, where quick access to
specific data is needed.

Single-User vs. Multiuser Database


Systems
 Single-User Database System:
o Located on a single computer and
accessed by one person at a time.
o Commonly used for personal tasks
or small business needs.
 Multiuser Database System:
o Designed for multiple people to
access at once,
o ideal for business settings where
several users may need to view or
edit data simultaneously.
o Most business databases today are
multiuser databases.
Centralized vs. Distributed Database
Systems
 Centralized Database System:
o All data is stored on one main
computer, like a server.
o Easy to manage, but if the server
goes down, access to the database
is lost.
 Distributed Database System:
o Data is spread across multiple
computers connected through a
network.
o Although the data is physically
separate, it looks like a single
database to users. This setup is
often more reliable and scalable for
large organizations.

Disk-Based vs. In-Memory Database


Systems
 Disk-Based Systems:
o Store data on hard drives (disk
storage).
o Ideal for general use, but slower
than in-memory databases
because reading from a disk takes
more time.
 In-Memory Database Systems
(IMDBs):
o Store data directly in the
computer’s main memory (RAM).
o Much faster than disk-based
systems and often used for high-
performance applications where
speed is critical.
o Note: Because memory is volatile,
good backup systems are essential
to prevent data loss.

Hierarchical and Network Database


Models
 Hierarchical Databases:
o Organize data in a tree structure,
like a family tree.
o Each “parent” node can have
multiple “child” nodes (one-to-
many relationship).
o Rarely used in modern databases
but useful when data naturally
forms a hierarchy (e.g., an
organization chart).
 Network Databases:
o Allow more complex relationships,
including both one-to-many and
many-to-many relationships
between data elements.
o More flexible than hierarchical
databases, but also more complex
to manage.
 Modern Databases: Most databases
today use the relational model instead
of these older hierarchical or network
models because it’s more adaptable
and easier to use.

Creating a Relational Database


1. Creating the Tables:
o Tables are created based on the
design process where each table
structure is defined.
o In Microsoft Access, you can use
Design View (for setting up fields
and properties) or Datasheet
View (to see data in a
spreadsheet-like format).

2. Entering and Editing Data:


o Data from an old system can be
transferred (migrated) to the new
database.
o New data can be entered manually
through forms or datasheets, which
allow you to interact with the
database visually.

3. Relating Tables:
o After creating tables, you can link
them using Primary Keys (unique
identifiers for each table).
o Relationships help maintain data
integrity, for example, by linking
“Customer ID” in an Orders table to
“Customer ID” in a customer’s
table. This ensures each order is
correctly associated with a
customer.
Retrieving Information from a
Relational Database
 Query: A query is a request for
specific information from a database.
For example, you might query a
database to find all customers who
bought a particular product.
o Every database management
system (DBMS) provides tools to
help users query the database
using certain criteria to quickly
retrieve the data they need.

Maintaining a Relational Database


To keep a relational database efficient and
up-to-date, ongoing maintenance task
may include:
1. Modifying Table Structures:
Adjusting tables when needed, like
adding new columns.
2. Adding Indexes: Indexes are
added to make specific queries faster
by creating shortcuts for frequently
searched data.
3. Deleting Obsolete Data:
Removing outdated information to free
up storage and keep the database
clean.
4. Upgrading Software and
Installing Patches: Keeping the
database system updated to improve
performance and security.
5. Repairing or Restoring Corrupt
Data: Fixing any data that might have
been damaged.
6. Improving Security: Regularly
assessing and enhancing security
measures to protect data.

The Object-Oriented Database Model


 Object-Oriented Database
Management System (OODBMS):
This database type stores data as
objects, which can include different
data types (like text, images, or
videos) and the methods to work with
that data.
o Objects: Similar to real-world
objects, each object has both data
and behaviors. For example, a
“Video” object might contain the
video file along with methods to
play, pause, or stop it.
o Object Query Language (OQL):
Used to retrieve objects, OQL is a
query language similar to SQL but
designed specifically for object
databases.
o Reuse of Objects: Objects in an
OODBMS can be reused in different
applications, making it easier to
develop new software that shares
data and functions with existing
applications.
Reports
 Reports: A report is a formatted view
of database data, often used to display
the results of a query in an easy-to-
read format.
o Reports can pull data from multiple
tables to show a more
comprehensive view of information.
o Many software tools, like Microsoft
Access, offer wizards to help users
create reports quickly, and they
can be further customized in
Design View.
o In programs like Access, reports are
saved as objects within the
database file, allowing users to
access and modify them as
needed.
Hybrid Database Models
 Hybrid Database Model: This type
of database combines elements from
different database models to support a
wider variety of data needs.
o For example, a Hybrid
XML/Relational Database can
store both XML data (used for
structured documents) and
relational data (stored in tables).
o Hybrid databases offer flexibility
and are often used when a
database needs to support multiple
data formats.

Cloud Databases
 Cloud Databases are hosted by a
cloud provider (like Amazon, Microsoft,
or Google) and accessed online,
making them very flexible and easy to
scale up as needed. Users can access
them from anywhere via the internet.
 Examples of Cloud Database Uses:
o Information Retrieval: Cloud
databases are widely used for
storing data that people search for
online, like on search engines.
o E-Commerce: They support online
stores by providing information on
products, pricing, and customer
details. Cloud databases allow web
pages to be dynamic, meaning
they can change and update
automatically with new data (for
example, showing an updated
shopping cart).
 Benefits:
o Less Hardware and
Maintenance: Since they’re
hosted on the cloud, businesses
don’t need as much hardware on-
site and require less maintenance.
o Web Apps: Individuals can also
use tools like Microsoft Access to
create cloud databases for simple
web applications.
 How They Work:
o When a user interacts with a web
form (e.g., selecting a menu item
or filling out a form), the web
server sends this request as a
query to the database server.
o The database server processes the
query and returns the requested
data, which the web server then
displays to the user.

Middleware
 Middleware is software that connects
different applications, allowing them to
work together. For example,
middleware links a web server (which
hosts the website) with a database
management system (where the data
is stored).
 Common Middleware Languages:
o JavaScript
o VBScript
o CGI Scripts
o Active Server Pages (ASP)
o PHP
Middleware handles communication
between the web server and database,
enabling the website to pull data from the
database and display it to users. This
behind-the-scenes software is essential
for making cloud databases and websites
work smoothly together.

You might also like