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

Chapter 1 - Database Concepts

This document covers the fundamentals of databases, including definitions, purposes, and types such as relational and non-relational databases. It also introduces SQL and RDBMS, focusing on MySQL, and explains core components like tables, rows, columns, and keys in relational database architecture. Additionally, it discusses database schema design, data types, and practical exercises for applying these concepts.

Uploaded by

wegabrice05
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)
16 views

Chapter 1 - Database Concepts

This document covers the fundamentals of databases, including definitions, purposes, and types such as relational and non-relational databases. It also introduces SQL and RDBMS, focusing on MySQL, and explains core components like tables, rows, columns, and keys in relational database architecture. Additionally, it discusses database schema design, data types, and practical exercises for applying these concepts.

Uploaded by

wegabrice05
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/ 25

Chapter 1: Database Concepts

Lesson 1: What is a Database? Types of Databases (Relational vs.


Non-Relational)
In today's data-driven world, databases play a crucial role in storing, managing, and retrieving data
efficiently. Understanding what databases are and the different types available is fundamental for
anyone diving into the fields of computer science, information technology, or data management.

What is a Database?
Definition

A database is an organized collection of structured information or data, typically stored


electronically in a computer system. Databases are designed to manage large bodies of information
by enabling efficient data retrieval, insertion, deletion, and updating.

Purpose of Databases

• Data Organization: Databases organize data in a way that makes it easily accessible,
manageable, and updateable.
• Data Integrity: They ensure the accuracy and consistency of data over its entire
lifecycle.
• Concurrent Access: Multiple users can access and manipulate data simultaneously
without compromising data integrity.
• Security: Databases provide mechanisms to control access and protect data from
unauthorized users.

Real-World Examples

• Banking Systems: Managing customer accounts, transactions, and financial records.


• Online Retail: Storing product catalogs, customer orders, and inventory management.
• Healthcare Records: Keeping patient information, medical histories, and appointment
schedules.

Types of Databases
Databases can be broadly classified into two categories:

Relational Databases
A relational database is a type of database that stores and provides access to data points that are
related to one another. Data is organized into tables (also known as relations) consisting of rows
and columns.

Characteristics

• Structured Schema: Requires a predefined schema that outlines the tables, fields, and
relationships.
• Tables and Relationships: Data is stored in tables, and relationships between data are
established through primary and foreign keys.
• SQL (Structured Query Language): Uses SQL for querying and maintaining the
database.
• ACID Compliance: Ensures Atomicity, Consistency, Isolation, and Durability in
transactions.

Examples: MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server

When to Use Relational Databases

• Structured Data: When data is highly structured and relationships between data are
well-defined.
• Complex Queries: Ideal for complex queries and transactions that require joins and
referential integrity.
• Data Integrity: When data accuracy and integrity are critical.

Non-Relational Databases (NoSQL)

Non-relational databases, commonly referred to as NoSQL databases, store data in a format


other than relational tables. They are designed to handle large volumes of data, often distributed
across many servers.

Types of NoSQL Databases

1. Document Stores: Store data in documents similar to JSON (e.g., MongoDB).


2. Key-Value Stores: Data is stored as key-value pairs (e.g., Redis).
3. Column Stores: Store data in columns rather than rows (e.g., Apache Cassandra).
4. Graph Databases: Designed to store and navigate relationships between data points (e.g.,
Neo4j).

Characteristics

• Flexible Schema: Schemaless or dynamic schema allows for flexibility in data storage.
• Horizontal Scalability: Designed to scale out by adding more servers.
• High Performance: Optimized for read/write performance with large volumes of data.
• Distributed Architecture: Data is distributed across multiple nodes for fault tolerance.

Examples : MongoDB (Document Store), Redis (Key-Value Store), Apache Cassandra


(Column Store), Neo4j (Graph Database)

When to Use Non-Relational Databases

• Unstructured Data: Ideal for storing unstructured or semi-structured data.


• Scalability Needs: When the application requires horizontal scalability and high
throughput.
• Rapid Development: Flexible schemas allow for quick iterations and changes.

Comparison: Relational vs. Non-Relational Databases


Aspect Relational Databases Non-Relational Databases
Data Model Tables with rows and columns, Flexible schema, various data models
predefined schema (document, key-value, etc.)
Schema Rigid, requires alterations to Flexible, can evolve over time
change
Query SQL Varies (e.g., MongoDB query language)
Language
Scalability Vertical (adding more power to Horizontal (adding more servers)
existing servers)
Use Cases Complex transactions, data Large volumes of data, rapid
integrity is crucial development, unstructured data
Examples MySQL, PostgreSQL, Oracle MongoDB, Redis, Apache Cassandra

Lesson 2: Introduction to SQL & RDBMS (e.g., MySQL)


In the previous lesson, we explored the fundamentals of databases and the distinctions between
relational and non-relational databases. Building on that foundation, this lesson delves into
Structured Query Language (SQL) and Relational Database Management Systems
(RDBMS), with a focus on MySQL as a practical example. Understanding SQL and RDBMS is
crucial for managing and manipulating data in a structured and efficient manner.

Objectives

By the end of this lesson, you should be able to:

• Define SQL and explain its purpose in relational databases.


• Understand the core concepts and architecture of RDBMS.
• Perform basic SQL operations such as creating databases and tables, and executing
queries.
• Recognize the features of MySQL and how it implements SQL as an RDBMS.

What is SQL?
Structured Query Language (SQL) is a standardized programming language designed for
managing and manipulating relational databases. SQL allows you to create, retrieve, update, and
delete data within a database.

Core Components of SQL


Data Definition Language (DDL)

Used to define and modify database structures.

• CREATE: Create databases, tables, indexes.


• ALTER: Modify existing database objects.
• DROP: Delete databases, tables, indexes.

Data Manipulation Language (DML)

Used for data manipulation within existing structures.

• SELECT: Retrieve data from one or more tables.


• INSERT: Add new data into tables.
• UPDATE: Modify existing data.
• DELETE: Remove data from tables.

Data Control Language (DCL)

Used to control access to data within the database.

• GRANT: Give users access privileges.


• REVOKE: Remove user access privileges.

Transaction Control Language (TCL)

Manages transactions within the database.

• COMMIT: Save all changes made during the current transaction.


• ROLLBACK: Revert changes made during the current transaction.
• SAVEPOINT: Set a savepoint within a transaction.
What is a Relational Database Management System (RDBMS)?

An RDBMS is a software system that enables the creation, management, and manipulation of
relational databases. It provides the interface between users and applications and the database
itself.

Key Components

• Database Engine: Core service for storing, processing, and securing data.
• Database Schema: Defines the logical structure, including tables, views, and indexes.
• Query Processor: Interprets and executes SQL queries.
• Storage Manager: Handles data storage on disk.
• Transaction Manager: Ensures data integrity through ACID properties.

ACID Properties

• Atomicity: Transactions are all-or-nothing.


• Consistency: Transactions lead from one valid state to another.
• Isolation: Transactions do not interfere with each other.
• Durability: Once a transaction is committed, it remains so.

Introduction to MySQL

MySQL is an open-source RDBMS that uses SQL for data access. It is widely used due to its
reliability, performance, and ease of use.

Features

• Open Source: Freely available under the GNU General Public License.
• Cross-Platform Support: Runs on various operating systems like Windows, Linux, and
macOS.
• High Performance: Optimized for speed, especially in web applications.
• Scalability: Suitable for small applications to large-scale enterprise systems.
• Security: Provides robust security features for data protection.
• Replication: Supports data replication for redundancy and failover.

Editions

• MySQL Community Edition: Free version with core functionalities.


• MySQL Enterprise Edition: Paid version with additional features like advanced
security, scalability, and support.
Basic SQL Operations in MySQL
Creating a Database
CREATE DATABASE company_db;

Selecting a Database
USE company_db;

Creating a Table
CREATE TABLE employees (
employee_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
department VARCHAR(50),
salary DECIMAL(10, 2)
);

Inserting Data into a Table


INSERT INTO employees (first_name, last_name, department, salary) VALUES
('Alice', 'Johnson', 'Marketing', 60000.00),
('Bob', 'Smith', 'Engineering', 75000.00);

Querying Data

• Select All Records

SELECT * FROM employees;

• Select Specific Columns

SELECT first_name, last_name FROM employees;

Updating Records
UPDATE employees
SET salary = 80000.00
WHERE employee_id = 2;

Deleting Records
DELETE FROM employees
WHERE employee_id = 1;

Lesson 3: Database Architecture (Tables, Rows, Columns)

Introduction
In the previous lessons, we explored the fundamentals of databases, SQL, and relational database
management systems like MySQL. Building upon that foundation, this lesson delves into the
core components of relational database architecture: tables, rows, and columns. Understanding
these elements is crucial for designing efficient databases, performing data manipulation, and
ensuring data integrity.

Objectives
By the end of this lesson, you should be able to:

• Understand the fundamental structure of relational databases.


• Define and describe the roles of tables, rows, and columns.
• Explain how tables relate to each other within a database.
• Recognize the importance of data types and constraints.
• Design simple database schemas utilizing tables, rows, and columns.

1. Overview of Relational Database Architecture


What is a Relational Database?

A relational database organizes data into tables, which are composed of rows and columns.
This structure allows for efficient data storage, retrieval, and manipulation. The relational model
was introduced by E.F. Codd in 1970 and has become the foundation for modern database
systems.

Key Components

• Tables: The primary units of data storage, representing entities.


• Rows (Records/Tuples): Individual entries in a table, representing a single data item.
• Columns (Fields/Attributes): Define the type of data stored and represent properties of
the entity.
• Keys: Used to uniquely identify rows and establish relationships between tables.

2. Tables
A table is a collection of related data organized into rows and columns. Each table represents a
specific entity or subject within the database, such as customers, products, or orders.

Structure of a Table

• Table Name: Uniquely identifies the table within the database.


• Columns: Define the data attributes and data types.
• Rows: Contain the actual data entries.

Example

Customers Table

customer_id first_name last_name email


1 John Doe [email protected]
2 Jane Smith [email protected]

Creating a Table in SQL


CREATE TABLE customers (
customer_id INT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL
);

3. Columns (Fields/Attributes)
A column represents a specific data attribute within a table. It defines the kind of data that can
be stored in that column through data types and constraints.

Data Types

Data types specify the type of data that can be stored in a column.

• Numeric Types: INT, DECIMAL, FLOAT


• Character Types: CHAR(n), VARCHAR(n), TEXT
• Date and Time Types: DATE, TIME, DATETIME, TIMESTAMP
• Boolean Type: BOOLEAN (TRUE or FALSE)
• Binary Types: BLOB (Binary Large Object)

4. Rows (Records/Tuples)
A row represents a single record in a table, containing data for each column.

Characteristics

• Each row corresponds to a unique record.


• Rows are often uniquely identified by a primary key.
• Data manipulation operations (INSERT, UPDATE, DELETE) are performed on rows.

Example

Inserting a row into the products table:

INSERT INTO products (product_id, product_name, price)


VALUES (1, 'Laptop', 999.99);

5. Keys in Relational Databases


Primary Key

A primary key is a column or a set of columns that uniquely identifies each row in a table.

Characteristics

• Must contain unique values.


• Cannot contain NULL values.
• Each table should have one primary key.

Example

CREATE TABLE orders (


order_id INT PRIMARY KEY,
order_date DATE NOT NULL,
customer_id INT NOT NULL
);

Foreign Key

A foreign key is a column or a set of columns in one table that references the primary key in
another table.
Characteristics

• Establishes a relationship between two tables.


• Enforces referential integrity.

Example

CREATE TABLE order_items (


order_item_id INT PRIMARY KEY,
order_id INT,
product_id INT,
quantity INT,
FOREIGN KEY (order_id) REFERENCES orders(order_id),
FOREIGN KEY (product_id) REFERENCES products(product_id)
);

6. Relationships Between Tables


Types of Relationships

• One-to-One: Each row in Table A is linked to one row in Table B.


• One-to-Many: A row in Table A can be linked to multiple rows in Table B.
• Many-to-Many: Rows in Table A can be linked to multiple rows in Table B and vice
versa (implemented using a junction table).

Implementing Relationships

• One-to-Many Example: A customer can place multiple orders.


o customers table (customer_id as primary key).
o orders table (customer_id as foreign key).
• Many-to-Many Example: Products and orders.
o products table.
o orders table.
o order_items table serves as a junction table linking products and orders.

7. Indexes
Definition

An index is a database object that improves the speed of data retrieval operations on a table at
the cost of additional writes and storage space.

Types of Indexes
• Single-Column Index: Index based on a single column.
• Composite Index: Index based on multiple columns.
• Unique Index: Ensures that all values in the index are unique.

Creating an Index
CREATE INDEX idx_customer_last_name ON customers(last_name);

Benefits of Indexes

• Accelerate search queries.


• Improve sorting operations.
• Enhance performance on JOIN operations.

Considerations

• Indexes require additional storage space.


• Can slow down INSERT, UPDATE, DELETE operations due to maintenance.

8. Designing a Database Schema


Steps in Schema Design

1. Requirement Analysis: Understand data storage needs.


2. Identify Entities: Determine the main objects (tables).
3. Define Relationships: Establish how tables relate.
4. Specify Columns and Data Types: Decide what data each table will hold.
5. Apply Constraints and Keys: Ensure data integrity.
6. Normalize the Database: Reduce redundancy.

Example Scenario: Library Database

Entities:

• Books
• Authors
• Members
• Loans

Tables and Relationships:

• books (book_id, title, genre)


• authors (author_id, first_name, last_name)
• book_authors (book_id, author_id) - Many-to-Many relationship between books and
authors.
• members (member_id, name, address)
• loans (loan_id, book_id, member_id, loan_date, return_date)

9. Data Types and Their Importance


Numeric Data Types

• INT: Whole numbers.


• DECIMAL(p,s): Precise fixed-point numbers.
• FLOAT/DOUBLE: Approximate floating-point numbers.

Character Data Types

• CHAR(n): Fixed-length strings.


• VARCHAR(n): Variable-length strings up to n characters.
• TEXT: Large strings.

Date and Time Data Types

• DATE: YYYY-MM-DD.
• TIME: HH:MM

• DATETIME: Combines DATE and TIME.


• TIMESTAMP: Stores date and time based on UTC.

Choosing the Right Data Type

• Accuracy: Ensure the data type can represent all possible values.
• Storage Efficiency: Use appropriate data types to conserve space.
• Performance: Some data types are faster to process.

11. Practical Exercise


Scenario: Student Enrollment System

Design a database schema for managing student enrollments in courses.


Entities and Tables:

• students

Column Data Type Constraints


student_id INT PRIMARY KEY
first_name VARCHAR(50) NOT NULL
last_name VARCHAR(50) NOT NULL
email VARCHAR(100) UNIQUE NOT NULL

• courses

Column Data Type Constraints


course_id INT PRIMARY KEY
course_name VARCHAR(100) NOT NULL
credits INT CHECK (credits > 0)

• enrollments

Column Data Type Constraints


enrollment_id INT PRIMARY KEY
student_id INT FOREIGN KEY REFERENCES students(student_id)
course_id INT FOREIGN KEY REFERENCES courses(course_id)
enrollment_date DATE DEFAULT CURRENT_DATE

Relationships:

• students and courses have a Many-to-Many relationship, implemented via enrollments


table.

Best Practices in Database Architecture


• Consistent Naming Conventions: Use clear and consistent names for tables and
columns.
• Data Normalization: Apply normalization rules to eliminate redundancy.
• Appropriate Data Types: Choose data types that best fit the data to be stored.
• Use Constraints: Enforce data integrity through constraints.
• Indexing Strategy: Create indexes on columns used frequently in search conditions.
• Documentation: Maintain up-to-date documentation of the database schema.

Common Pitfalls to Avoid


• Over-Normalization: Excessive normalization can lead to complex queries and
decreased performance.
• Under-Normalization: Not normalizing enough can cause data redundancy and
anomalies.
• Ignoring Data Types: Misusing data types can lead to data loss or inefficiency.
• Lack of Constraints: Without constraints, data integrity cannot be enforced.
• Improper Indexing: Over-indexing can slow down write operations; under-indexing can
slow down read operations.

Lesson 4: Normalization, Primary Key, Foreign Key, Unique Constraints

Objectives
By the end of this lesson, you should be able to:

• Understand the principles and benefits of database normalization.


• Define and implement primary keys and foreign keys.
• Apply unique constraints to enforce data uniqueness.
• Recognize how these concepts interrelate to enhance database design and integrity.

1. Database Normalization
Definition

Normalization is a systematic approach to organizing data in a database to reduce redundancy


and improve data integrity. It involves decomposing tables into smaller, well-structured tables
without losing data relationships.

Goals of Normalization

• Eliminate Redundant Data: Reduce duplication to save storage and maintain


consistency.
• Ensure Data Dependencies Make Sense: Store data logically according to relationships.
• Simplify Maintenance: Make it easier to update, insert, or delete data without affecting
other data.

Normal Forms

Normalization is achieved through a series of rules known as normal forms. The most
commonly applied normal forms are:
First Normal Form (1NF)

• Criteria:
o Each table cell contains a single (atomic) value.
o Each record is unique.
• Implementation:
o Eliminate repeating groups of data.
o Create separate tables for each group of related data.

Example Violation:

student_id student_name courses


1 Alice Smith Math, Science
2 Bob Jones English, History

Solution in 1NF:

Create a separate row for each course enrollment.

student_id student_name course


1 Alice Smith Math
1 Alice Smith Science
2 Bob Jones English
2 Bob Jones History

Second Normal Form (2NF)

• Criteria:
o Must be in 1NF.
o All non-key attributes are fully functionally dependent on the primary key.
• Implementation:
o Remove partial dependencies.
o Create separate tables for sets of values that apply to multiple records.

Example Violation:

A table with a composite primary key where non-key attributes depend only on part of the key.

Solution in 2NF:

Separate the table into two, ensuring that each non-key attribute is fully dependent on the
primary key.

Third Normal Form (3NF)

• Criteria:
o Must be in 2NF.
o No transitive dependencies (non-key attributes depend only on the primary key).
• Implementation:
o Remove columns that are not dependent upon the primary key.
o Create separate tables for related data.

Example Violation:

A table where a non-key attribute depends on another non-key attribute.

Solution in 3NF:

Move the dependent attribute to a new table.

Higher Normal Forms

While 1NF, 2NF, and 3NF are commonly used, higher normal forms like Boyce-Codd Normal
Form (BCNF), Fourth Normal Form (4NF), and Fifth Normal Form (5NF) exist for more
complex normalization needs.

2. Primary Keys
Definition

A primary key is a column or a combination of columns that uniquely identifies each row in a
table.

Characteristics

• Uniqueness: No two rows can have the same primary key value.
• Non-nullable: Primary key columns cannot contain NULL values.
• Immutable: The value of a primary key should not change over time.
• Single Column or Composite: Can consist of one column or multiple columns
(composite key).

Creating a Primary Key

Single-Column Primary Key:

CREATE TABLE employees (


employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50)
);
Composite Primary Key:

CREATE TABLE enrollment (


student_id INT,
course_id INT,
enrollment_date DATE,
PRIMARY KEY (student_id, course_id)
);

Best Practices

• Use surrogate keys (like auto-incrementing integers) when natural keys are complex.
• Ensure the primary key is minimal and contains only necessary columns.

3. Foreign Keys
Definition

A foreign key is a column or a set of columns in one table that references the primary key in
another table, establishing a relationship between the two tables.

Purpose

• Referential Integrity: Ensures that relationships between tables remain consistent.


• Data Validation: Prevents actions that would destroy links between tables.

Creating a Foreign Key


CREATE TABLE orders (
order_id INT PRIMARY KEY,
customer_id INT,
order_date DATE,
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
);

Actions on Foreign Keys

You can define actions that occur when the referenced data changes:

• ON DELETE CASCADE: Delete rows in the child table when the parent row is deleted.
• ON UPDATE CASCADE: Update the foreign key in the child table when the parent key
changes.

Example:
CREATE TABLE order_items (
order_item_id INT PRIMARY KEY,
order_id INT,
product_id INT,
FOREIGN KEY (order_id) REFERENCES orders(order_id) ON DELETE CASCADE
);

Best Practices

• Name foreign keys clearly to indicate the relationship.


• Index foreign key columns to improve JOIN performance.

6. Practical Examples
Example 1: Normalization Process

Unnormalized Table:

order_id customer_name product_name quantity


1 John Doe Laptop 1
1 John Doe Mouse 2
2 Jane Smith Keyboard 1

Normalization Steps:

1. First Normal Form (1NF): Data is already atomic.


2. Second Normal Form (2NF):
o Separate customer data into customers table.
o Separate product data into products table.
3. Third Normal Form (3NF):
o Remove any transitive dependencies (if any).

Resulting Tables:

• customers (customer_id, customer_name)


• orders (order_id, customer_id)
• products (product_id, product_name)
• order_items (order_id, product_id, quantity)

Lesson 5: Introduction to Database Management Systems (DBMS)

Introduction
In previous lessons, we've explored databases, SQL, and key concepts like normalization and keys.
This lesson focuses on Database Management Systems (DBMS)—the software that allows us to
create, manage, and interact with databases. Understanding DBMS is crucial for effectively
handling data storage, retrieval, and manipulation in various applications.

1. What is a Database Management System (DBMS)?


A Database Management System (DBMS) is software that interacts with end-users,
applications, and the database itself to capture and analyze data. It provides an interface for users
and applications to interact with databases securely and efficiently.

Purpose

• Data Management: Facilitates the creation, querying, updating, and administration of


databases.
• Data Abstraction: Provides an abstract view of data, hiding the complexities of how data
is stored and maintained.
• Data Security: Ensures that only authorized users can access the database.
• Data Integrity: Maintains data accuracy and consistency over its entire lifecycle.

2. Core Functions of a DBMS


Data Definition

• Schema Definition: Allows users to define the structure of the data, including tables,
fields, and relationships.
• Data Types and Constraints: Supports specifying data types and constraints to ensure
data integrity.

Data Manipulation

• Data Insertion: Adding new data to the database.


• Data Update: Modifying existing data.
• Data Deletion: Removing data from the database.
• Data Retrieval: Querying data using languages like SQL.

Data Security

• Authentication: Verifying the identity of users accessing the database.


• Authorization: Granting permissions to users based on roles and privileges.
• Encryption: Protecting data at rest and in transit from unauthorized access.
Transaction Management

• ACID Properties: Ensuring transactions are Atomic, Consistent, Isolated, and Durable.
• Concurrency Control: Managing simultaneous operations without conflicting.

Data Backup and Recovery

• Backup: Creating copies of the database to prevent data loss.


• Recovery: Restoring the database to a previous state after a failure.

Data Integrity

• Integrity Constraints: Enforcing rules to maintain accuracy and consistency.


• Referential Integrity: Ensuring foreign keys correctly reference primary keys.

3. Components of a DBMS
Database Engine

• The core service for storing, processing, and securing data.


• Handles data storage, query processing, and transaction management.

Query Processor

• Interprets and executes database queries.


• Optimizes queries for efficient execution.

Storage Manager

• Manages data storage on physical media.


• Handles data retrieval, caching, and indexing.

Transaction Manager

• Ensures that all database transactions are processed reliably.


• Manages concurrency and maintains ACID properties.

Metadata Catalog (Data Dictionary)

• Stores metadata about the database structure.


• Includes information about tables, columns, data types, and constraints.

User Interface
• Provides tools for users to interact with the database.
• Includes command-line interfaces, graphical user interfaces, and APIs.

4. Types of DBMS Architectures


Centralized DBMS

• All database management activities occur on a single system.


• Suitable for small organizations with limited data and users.

Distributed DBMS

• Data is distributed across multiple sites connected via a network.


• Provides data localization, improved reliability, and scalability.

Client-Server DBMS

• The database resides on a server, and clients access it over a network.


• Separates the database system (server) from the application logic (client).

Parallel DBMS

• Uses multiple processors and disks to perform parallel operations.


• Enhances performance for large-scale data processing.

Cloud-Based DBMS

• Database services are provided over the cloud.


• Offers scalability, flexibility, and reduced infrastructure costs.

5. Types of Databases Managed by DBMS


Relational Databases

• Use tables to store data with predefined schemas.


• Managed using SQL.
• Examples: MySQL, PostgreSQL, Oracle Database.

NoSQL Databases
• Designed for unstructured data with flexible schemas.
• Includes document stores, key-value stores, column stores, and graph databases.
• Examples: MongoDB (document store), Cassandra (column store), Redis (key-value
store).

Object-Oriented Databases

• Store data in the form of objects, as used in object-oriented programming.


• Examples: ObjectDB, db4o.

Hierarchical Databases

• Data is organized in a tree-like structure.


• Each child record has only one parent.
• Example: IBM Information Management System (IMS).

Network Databases

• Allow more complex relationships; records can have multiple parent and child records.
• Uses a network structure to create relationships.

6. Advantages of Using a DBMS


Data Abstraction and Independence

• Provides a simplified view of data to users.


• Changes in the data structure do not affect the application layer.

Efficient Data Access

• Optimizes data retrieval and manipulation using indexes and query optimization
techniques.

Data Integrity and Security

• Enforces data integrity constraints.


• Implements security measures to protect data.

Data Administration

• Centralizes data management, reducing redundancy.


• Facilitates data backup and recovery procedures.
Concurrent Access and Crash Recovery

• Supports multiple users accessing data simultaneously.


• Provides mechanisms to recover from system failures.

7. Disadvantages of Using a DBMS


Complexity

• Requires specialized personnel for design, implementation, and maintenance.

Cost

• Licensing fees for commercial DBMS software can be high.


• Hardware and training costs can also be significant.

Performance Overhead

• May introduce performance overhead due to abstraction layers.


• Requires tuning and optimization for high-performance applications.

Maintenance

• Regular updates, backups, and security patches are necessary.


• Ongoing administration is required to ensure optimal operation.

8. Popular DBMS Software


Relational DBMS

• MySQL
o Open-source, widely used for web applications.
• PostgreSQL
o Open-source, known for advanced features and compliance.
• Oracle Database
o Commercial, robust features for large enterprises.
• Microsoft SQL Server
o Commercial, integrated with Microsoft technologies.

NoSQL DBMS
• MongoDB
o Document-oriented, scalable and flexible schema.
• Apache Cassandra
o Columnar database, designed for high availability.
• Redis
o In-memory key-value store, used for caching and real-time analytics.

Cloud-Based DBMS

• Amazon RDS
o Managed relational database service.
• Google Cloud SQL
o Managed database service for MySQL, PostgreSQL.
• Azure SQL Database
o Managed relational cloud database service.

9. Use Cases and Applications


E-commerce

• DBMS Role: Manage product catalogs, customer information, and transactions.


• Requirements: High availability, security, scalability.

Banking and Finance

• DBMS Role: Handle account management, transactions, and compliance reporting.


• Requirements: Strong security, ACID compliance, auditing capabilities.

Healthcare

• DBMS Role: Store patient records, appointments, and medical histories.


• Requirements: Data privacy, integrity, compliance with regulations like HIPAA.

Education

• DBMS Role: Manage student records, course enrollments, and grades.


• Requirements: Data consistency, access control, reporting features.

Social Media

• DBMS Role: Handle user profiles, posts, messaging.


• Requirements: High scalability, performance, data sharding.
10. Security Features in DBMS
Authentication and Authorization

• User Accounts: Control who can access the database.


• Roles and Permissions: Assign specific rights to users or groups.

Data Encryption

• At Rest: Encrypting data stored on disk.


• In Transit: Encrypting data transmitted over the network using SSL/TLS.

Auditing and Logging

• Activity Logs: Record actions performed on the database.


• Audit Trails: Monitor and review user activities for compliance.

SQL Injection Prevention

• Input Validation: Sanitizing user input to prevent malicious queries.


• Prepared Statements: Using parameterized queries to enhance security.

You might also like