Database Assignment
Database Assignment
A database is an organized collection of data that is electronically stored and accessed. Databases
can store structured, semi-structured, or unstructured data, such as text, images, videos, and files,
making them indispensable for modern applications. They are managed using Database
Management Systems (DBMS), which are software tools that enable users to create, retrieve, update,
and manage data efficiently.
Database Languages
Database languages are specialized sets of commands and instructions used to define, manipulate,
and control data within a database. Each language type plays a distinct role in database
management, ensuring efficient storage, retrieval, and security of data. The primary database
languages include:
DDL is the short name for Data Definition Language, which deals with database schemas and
descriptions, of how the data should reside in the database.
CREATE: to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
TRUNCATE: remove all records from a table, including all spaces allocated for the
records are removed
DMS focuses on manipulating the data stored in the database, enabling users to retrieve,
add, update, and delete data.
SAVEPOINT: Sets a point within a transaction to which one can later roll back.
SELECT: The primary DQL command, used to query data from the database without
altering its structure or contents.
Databases are used in most modern applications, whether the database is on our personal phone,
computer, or the internet. An operational database system will store much of the data an application
needs to function, keeping the data organized and allowing users to access the data. If we were
building an eCommerce app, some of the data we might access and store in our operational
database system includes:
Relationship data, like the locations of stores with a specific product in stock.
In essence, databases act as the backbone of most modern applications, ensuring that users can
store, retrieve, and update data in a reliable and efficient way.
Types of Databases
Databases can be classified based on their structure, usage, storage methods, and intended
application. Understanding these types will help us choose the best database for our needs.
1. Hierarchical Databases
2. Network Databases
3. Object-oriented Databases
4. Relational Databases
5. Cloud Database
6. Centralized Database
7. Operational Database
8. NoSQL Databases
1. Hierarchical Databases
Hierarchical databases organize data in a tree-like structure, where each parent record can have
multiple child records. This model works well for scenarios where data follows a predefined
hierarchical relationship, where data is arranged in levels or ranks. For example, in a university,
"University" is at the top level, while "Departments" and "Administration" are at lower levels, even
though they are distinct entities.
This structure can also be viewed as a parent-child relationship, where each parent record can have
multiple child records, but a child record can only have one parent. As more data is added, the
structure expands like a tree. Example: IBM's Information Management System (IMS) is a well-known
hierarchical database.
Advantages
Disadvantages
A network databases builds on the hierarchical model but allows child records to link to multiple
parent records, creating a web-like structure of interconnected data. This results in a more flexible
structure, often referred to as a graph model, where entities can be connected in many different
ways. For example, in a university database, "Students," "Faculty," and "Resources" can be linked to
both "Departments" and "Clubs," forming a flexible, two-directional relationship.
This model is ideal for complex frameworks as it effectively represents many-to-many relationships.
Additionally, its structure simplifies the use of certain database management languages. Example:
The Integrated Data Store (IDS) is a well-known example of a network database.
Advantages:
Disadvantages:
3. Object-Oriented Databases
Object-oriented databases are based on the principles of object-oriented programming (OOP), where
data is stored as objects. These objects include attributes (data) and methods (functions), making
them easily referenced and manipulated. These databases are designed to handle complex data
structures such as multimedia, graphics, and large files.
Object-Oriented Example
For instance, a "Person" object in the database could include attributes like Name and Address and
methods like get Latest Address to retrieve information. This approach reduces the workload on the
database by allowing objects to be reused and linked directly, streamlining data
access and manipulation. Each object behaves as an instance of the database model, enabling
efficient operations.
Advantages:
Useful for applications requiring complex data models, such as CAD (Computer-Aided Design)
or multimedia systems.
Disadvantages:
A practical example of this model is the Berkeley DB software library, which is designed for fast and
efficient query responses in embedded systems. Object-oriented databases are especially useful for
applications involving complex data types or multimedia content.
4. Relational Databases
Relational databases are the most widely used type of database today. They store data in tables, with
rows representing records and columns representing attributes of the records. In this database, every
piece of information has a relationship with every other piece of information. This is on account of
every data value in the database having a unique identity in the form of a record.
Relational Database Example
Due to this introduction of tables to organize data, it has become exceedingly popular. In
consequence, they are widely integrated into Web-Ap interfaces to serve as ideal repositories for
user data. What makes it further interesting in the ease in mastering it, since the language used to
interact with the database is simple (SQL in this case) and easy to comprehend.
In Relational databases, scaling and traversing through data is quite a lightweight task in comparison
to Hierarchical Databases. Example: MySQL, PostgreSQL, and Oracle Database are some popular
relational databases.
Advantages:
Disadvantages:
5. Cloud Databases
Microsoft Azure
ScienceSoft, etc.
Advantages:
Easier to manage and maintain as most of the infrastructure is managed by cloud service
providers.
Disadvantages:
6. Centralized Databases
A centralized database is a database stored and managed at a single location, such as a central
server or data center. It ensures higher security and consistency as all data is maintained in one
place, making it easier to control and manage.
Users access the database remotely to fetch or update information. Centralized databases are
commonly used in enterprise systems where data consistency and security are critical.
However, scalability and performance limitations should be carefully considered.
Advantages
Data Security: Centralized storage makes it easier to implement robust security measures.
Disadvantages
Response Time: The large size of centralized databases can lead to slower data retrieval
times.
7. Personal Databases
A personal database is a small-scale database designed for a single user, typically used on personal
computers or mobile devices. These databases are ideal for managing individual data
like contacts, budgets, notes, or schedules. They are lightweight, easy to use, and require minimal
database administration, making them accessible for non-technical users.
Examples are:
Microsoft Access: A simple database solution for personal or small business needs.
Advantages:
1. Ease of Use: Simple to set up and manage without requiring advanced technical skills.
2. Low Storage Requirements: Occupies minimal space, making it suitable for smaller devices.
Disadvantages:
8. Operational Databases
An operational database is designed to manage and process real-time data for daily operations
within organizations and businesses. It allows users to create, update, and delete data efficiently,
ensuring that the database reflects current activities and transactions.
These databases handle live transactions and provide quick access to up-to-date data. Example: SAP
HANA is an example of an operational database used for high-speed transactions and analytics.
Advantages:
1. Easy to Fetch: Data retrieval is quick and efficient, supporting operational tasks.
2. Structured Data: Organizes data systematically for better management and access.
Disadvantages:
9. NoSQL Databases
NoSQL databases are known for their simplicity of design, horizontal scalability (adding more servers
for scaling), and high availability. Unlike relational databases, their data structures allow faster
operations in certain use cases. MongoDB, for instance, is a widely used document-based NoSQL
database.
Advantages
Disadvantages
Database Components
A Database Management System (DBMS) comprises several key components that work together to
store, organize, retrieve, and manage data efficiently. Each component plays a vital role in ensuring
the functionality, performance, and security of the database.
1. Data: The core component, representing the actual information stored in the database, whether
structured, semi-structured, or unstructured.
2. Schema: Defines the structure of the database, including tables, columns, data types, and
relationships, serving as a blueprint for data organization.
3. Query Language: Tools like SQL enable users to retrieve, modify, and manage data efficiently using
commands and queries.
4. Indexes: Special data structures that enhance query performance by enabling faster searches
within the database.
5. Transactions: Mechanisms that ensure data integrity and consistency through ACID properties,
allowing grouped operations to execute reliably.
7. Security: Measures like authentication, authorization, and encryption protect the database from
unauthorized access or tampering.
8. Backup and Recovery: Processes to secure data and restore it in case of hardware failures,
cyberattacks, or other disasters.
9. Performance Monitoring: Tools and techniques to track database performance, identify issues,
and optimize resource usage.
Advantages of Databases
Data Security: Protects sensitive data with strong access controls and encryption.
Disadvantages of Databases
High Costs: Setting up and maintaining a database can be expensive.
2. Data Storage and Retrieval: Efficient mechanisms for storing data and executing queries to
retrieve it quickly.
3. Concurrency Control: Ensures multiple users can access the database simultaneously
without conflicts.
4. Data Integrity and Security: Enforces rules to maintain accurate and secure data, including
access controls and encryption.
5. Backup and Recovery: Protects data with regular backups and enables recovery in case of
system failures.
Types of DBMS
There are several types of Database Management Systems (DBMS), each tailored to different data
structures, scalability requirements, and application needs. The most common types are as follows:
A typical example can be seen in a file-based university management system, where data was stored
in separate sections such as Departments, Academics, Results, Accounts, and Hostels. Certain
information like student names and phone numbers was repeated across multiple files, leading to
the following issues:
1. Redundancy of data
When the same data exists in multiple places, any update must be manually repeated everywhere.
For instance, if a student changes their phone number, it must be updated across all sections. Failure
to do so leads to unnecessary duplication and wasted storage.
2. Inconsistency of Data
Data is said to be inconsistent if multiple copies of the same data do not match each other. If the
Phone number is different in Accounts Section and Academics Section, it will be inconsistent.
Inconsistency may be because of typing errors or not updating all copies of the same data.
A user should know the exact location of the file to access data, so the process is very cumbersome
and tedious. If the user wants to search the student hostel allotment number of a student from
10000 unsorted students’ records, how difficult it can be.
4. Lack of Security
File systems provided limited control over who could access certain data. A student who gained
access to a file with grades might easily alter it without proper authorization, compromising data
integrity.
5. No Concurrent Access
File systems were not designed for multiple users working at the same time. If one user was editing a
file, others had to wait, which hindered collaboration and slowed down workflows.
Advantages of DBMS
1. Data organization: A DBMS allows for the organization and storage of data in a structured
manner, making it easy to retrieve and query the data as needed.
2. Data integrity: A DBMS provides mechanisms for enforcing data integrity constraints, such as
constraints on the values of data and access controls that restrict who can access the data.
4. Data security: A DBMS provides tools for managing the security of the data, such as
controlling access to the data and encrypting sensitive data.
5. Backup and recovery: A DBMS provides mechanisms for backing up and recovering the data
in the event of a system failure.
6. Data sharing: A DBMS allows multiple users to access and share the same data, which can be
useful in a collaborative work environment.
Disadvantages of DBMS
1. Complexity: DBMS can be complex to set up and maintain, requiring specialized knowledge
and skills.
2. Performance overhead: The use of a DBMS can add overhead to the performance of an
application, especially in cases where high levels of concurrency are required.
3. Scalability: The use of a DBMS can limit the scalability of an application, since it requires the
use of locking and other synchronization mechanisms to ensure data consistency.
4. Cost: The cost of purchasing, maintaining and upgrading a DBMS can be high, especially for
large or complex systems.
5. Limited Use Cases: Not all use cases are suitable for a DBMS, some solutions don't need high
reliability, consistency or security and may be better served by other types of data storage.
Applications of DBMS
1. Enterprise Information: Sales, accounting, human resources, Manufacturing, online retailers.
2. Banking and Finance Sector: Banks maintaining the customer details, accounts, loans,
banking transactions, credit card transactions. Finance: Storing the information about sales
and holdings, purchasing of financial stocks and bonds.
3. University: Maintaining the information about student course enrolled information, student
grades, staff roles.
4. Airlines: Reservations and schedules.