0% found this document useful (0 votes)
78 views35 pages

Unit 1

Uploaded by

harsh1234mathur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views35 pages

Unit 1

Uploaded by

harsh1234mathur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Traditional File System

File system is collection of data. In this system, user has to write


procedures for managing database. It provides details of data
representation and storage of data. In this –
 Data is stored in files.
 Each file has specific format.
 Programs that use these files depend on knowledge about that
format.
 In earlier days, database applications were built on top of file
systems.
This approach is mostly obsolete but –
 Understanding problems inherent in file based systems may
prevent us from repeating these problems in our database
system.
 Understanding how file system works is extremely useful when
converting a file-based system to a database system.
Basically, it is a collection of application programs that performs
services for end users such as production of reports. Each file
defines and manages its own data.
It doesn’t have a crash mechanism i.e., if system crashes while
entering some data, then content of file will be lost. This is
disadvantage of traditional file based system. Also, it is very difficult
to protect a file under the file system. This system can’t efficiently
store and retrieve data.
Advantages of Traditional File System :
 File processing cost less and can be more speed than database.
 File processing design approach was well suited to mainframe
hardware and batch input.
 Companies mainly use file processing to handle large volumes of
structured data on a regular basis.
 It can be more efficient and cost less than DBMS in certain
situations.
 Design is simple.
 Customization is easy and efficient.
Disadvantages of Traditional File System :
 Data redundancy and inconsistency.
 Difficulty in accessing data.
 Data isolation – multiple files and formats.
 Integrity problems
 Unauthorized access is not restricted.
 It co-ordinates only physical access.
To overcome disadvantages of File system, DBMS came in
use
DBMS- This stands for Database Management System. It is
collection of inter-related data. It has set of programs to access the
data. Basically, it contains information about particular enterprise. It
provides convenient and efficient environment for use.
Applications of DBMS :
 Banking
 Airlines
 Universities
 Sales
 Manufacturing
 Human Resources

Characteristics of the Database Approach


In this article, we will discuss the overview of the Database
Approach and will mainly focus on its characteristics. Also, we will
cover the Characteristics of the Database Approach in detail.
Overview of Database Approach
There are different characteristics of the database approach from
the much older approach of programming with files. In a traditional
file processing system, each user defines and implements its own
modifications to the files needed for a selected software application
as a part of programming the appliance. In the database approach,
one repository maintains data which is defined once then accessed
by various users in that database. In a file system, it will be
independently like an application that is free to name elements. In
comparison, during a database, the names or labels of knowledge
are defined once and used repeatedly by queries, transactions, and
applications.
Characteristics of Database Approach
Some of the most important characteristics of the database
approach to the file processing approach are the following as
follows.
Approach-1 : Self-Describing Nature of a Database System
 One of the most fundamental characteristics of the database
approach is that the database system contains not only the
database itself but also an entire definition or description of the
database structure and constraints also known as metadata of
the database.
 This definition is stored within the DBMS catalog, which contains
information like the structure of every file, the sort and storage
format of every data item, and various constraints/rules on the
information.
 The knowledge stored within the catalog is named meta-data,
and it describes the structure of the first database The catalog is
employed by the DBMS software and also by database users such
as database administrators who required to know the information
about the database structure.
 A general-purpose DBMS software package is not written for a
selected database application. Therefore, it must ask the catalog
to understand the structure of the files during a specific database,
like the sort and format of knowledge it will access.

Approach-2 : Insulation between Programs and Data, and


Data Abstraction
 In a traditional file processing system, the structure of database
knowledge files is embedded within the application programs, so
any changes to the structure of a file may require changing all
programs that access that file.
 Against this, DBMS access programs don’t require such changes
in most cases, so independence is achieved between them.
 The structure of knowledge files is stored within the DBMS catalog
separately from the programs that access them. We call this
property program-data independence.
 The characteristic that allows program-data independence and
program-operation independence is known as data abstraction.
Approach-3 : Support for Multiple Views of the Data
 A database sometimes has many users, each of whom may
require a special perspective or view of the database.
 A view could also be a subset of the database, or it’s going to
contain virtual data that is derived from the database files but
isn’t explicitly stored.
 Some users might not get to remember whether the information
they ask for is stored or derived.
 A multi-user DBMS whose users have a spread of distinct
applications must provide facilities for outlining multiple views.
This provides many benefits for large databases such as the
Aadhaar database.

Approach-4 : Sharing of knowledge and Multi-user


Transaction Processing
 A multi-user DBMS, as its name implies, must allow multiple users
to access the database at an equivalent time or concurrently.
 This is often essential if data for multiple applications is to be
integrated and maintained during a single database such as the
latest feature of WhatsApp integration with Facebook.
 The DBMS must implement concurrency control in the software to
make sure that several users trying to update equivalent data do
so in a controlled manner in order that the results of the updates
are correct.
 For instance, when several reservation agents attempt to assign a
seat on an airline flight, the DBMS should make sure that each
seat is often accessed by just one user agent at a single time for
an assignment to a passenger.

Components of Database System


A database is a structured collection of data that is managed and stored in a way that allows for
efficient retrieval, updating, and management. The main components of a database system
include the database itself, the Database Management System (DBMS), and various tools and
interfaces that allow users to interact with the data. Here are the key components:

1. Database

The database is the collection of data that is organized and stored. It can consist of several
elements, such as:

 Tables: The primary storage structure in a relational database, consisting of rows and columns.
 Records/Rows: Individual entries in a table, each representing a single data item or entity.
 Fields/Columns: Attributes or properties of the data, defining the type of data stored in each
record.
 Indexes: Structures that improve the speed of data retrieval operations on a table.

2. Database Management System (DBMS)

The DBMS is software that provides tools and services for creating, managing, and manipulating
databases. Key functions of a DBMS include:

 Data Definition Language (DDL): Used to define database structures, such as tables and indexes.
Common DDL commands include CREATE, ALTER, and DROP.
 Data Manipulation Language (DML): Used for querying and modifying data. Common DML
commands include SELECT, INSERT, UPDATE, and DELETE.
 Data Control Language (DCL): Used to control access to data. Common DCL commands include
GRANT and REVOKE.
 Transaction Management: Ensures data integrity and consistency through mechanisms like
commit and rollback.
 Concurrency Control: Manages simultaneous data access to prevent conflicts and ensure data
consistency.
 Backup and Recovery: Provides mechanisms to back up data and recover it in case of failure.

3. Database Schema

The schema defines the logical structure of the database, including tables, fields, relationships,
and constraints. Components of the schema include:

 Tables: Definitions of tables and their fields.


 Relationships: Associations between tables, often defined through foreign keys.
 Constraints: Rules that enforce data integrity, such as primary keys, foreign keys, and unique
constraints.

4. Query Processor

The query processor interprets and executes database queries. Key components include:

 Parser: Checks the syntax of SQL queries.


 Optimizer: Determines the most efficient way to execute a query.
 Execution Engine: Executes the query using the optimized query plan.

5. Storage Manager

The storage manager handles the storage, retrieval, and updating of data in the database. It
includes:

 File Manager: Manages the allocation of space on storage devices.


 Buffer Manager: Manages the buffer cache, which temporarily holds data in memory for quick
access.
 Index Manager: Manages the creation, maintenance, and use of indexes.

6. Metadata

Metadata is data about the data stored in the database. It includes:

 Data Dictionary: Contains information about database objects, such as tables, columns, indexes,
and users.
 Catalog: A system catalog that holds schema information and other metadata.
7. User Interface

The user interface allows users to interact with the database. It can include:

 Command Line Interface (CLI): Allows users to enter SQL commands directly.
 Graphical User Interface (GUI): Provides a more user-friendly way to interact with the database,
often with visual tools for query building and data management.
 Application Programming Interface (API): Enables applications to interact programmatically
with the database.

8. Database Applications

Applications are programs that interact with the database to perform specific tasks. Examples
include:

 Enterprise Resource Planning (ERP) Systems: Integrate various business processes and
functions.
 Customer Relationship Management (CRM) Systems: Manage customer data and interactions.
 Content Management Systems (CMS): Manage digital content and facilitate collaboration.

9. Security Management

Security management ensures that only authorized users have access to the database and its data.
Components include:

 Authentication: Verifies the identity of users.


 Authorization: Grants or denies permissions to users based on their roles.
 Encryption: Protects data from unauthorized access by converting it into a secure format.

Conclusion

These components work together to form a cohesive database system that allows for the efficient
storage, retrieval, and management of data. Understanding these components is essential for
designing, using, and maintaining effective database systems.

Advantages of Database Management


System
Database Management System (DBMS) is a collection of interrelated data
and a set of software tools/programs that access, process, and manipulate
data. It allows access, retrieval, and use of that data by considering
appropriate security measures. The Database Management system (DBMS)
is really useful for better data integration and security.
Advantages of DBMS

Advantages of Database Management System


The advantages of database management systems are:
1. Data Security: The more accessible and usable the database, the more it
is prone to security issues. As the number of users increases, the data
transferring or data sharing rate also increases thus increasing the risk of
data security. It is widely used in the corporate world where companies
invest large amounts of money, time, and effort to ensure data is secure
and used properly. A Database Management System (DBMS) provides a
better platform for data privacy and security policies thus, helping
companies to improve Data Security.
2. Data integration: Due to the Database Management System we have
access to well-managed and synchronized forms of data thus it makes
data handling very easy and gives an integrated view of how a particular
organization is working and also helps to keep track of how one segment
of the company affects another segment.
3. Data abstraction: The major purpose of a database system is to provide
users with an abstract view of the data. Since many complex algorithms
are used by the developers to increase the efficiency of databases that
are being hidden by the users through various data abstraction levels to
allow users to easily interact with the system.
4. Reduction in data Redundancy: When working with a structured
database, DBMS provides the feature to prevent the input of duplicate
items in the database. for e.g. – If there are two same students in different
rows, then one of the duplicate data will be deleted.
5. Data sharing: A DBMS provides a platform for sharing data across
multiple applications and users, which can increase productivity and
collaboration.
6. Data consistency and accuracy: DBMS ensures that data is consistent
and accurate by enforcing data integrity constraints and preventing data
duplication. This helps to eliminate data discrepancies and errors that can
occur when data is stored and managed manually.
7. Data organization: A DBMS provides a systematic approach to
organizing data in a structured way, which makes it easier to retrieve and
manage data efficiently.
8. Efficient data access and retrieval: DBMS allows for efficient data
access and retrieval by providing indexing and query optimization
techniques that speed up data retrieval. This reduces the time required to
process large volumes of data and increases the overall performance of
the system.
9. Concurrency and maintained Atomicity: That means, if some operation
is performed on one particular table of the database, then the change
must be reflected for the entire database. The DBMS allows concurrent
access to multiple users by using the synchronization technique.
10. Scalability and flexibility: DBMS is highly scalable and can easily
accommodate changes in data volumes and user requirements. DBMS
can easily handle large volumes of data, and can scale up or down
depending on the needs of the organization. It provides flexibility in data
storage, retrieval, and manipulation, allowing users to easily modify the
structure and content of the database as needed.

Disadvantages of DBMS
There are many advantages and disadvantages of DBMS (Database
Management System). The disadvantages of DBMS are explained
below.
1. Increased Cost:
These are different types of costs:

1. Cost of Hardware and Software –


This is the first disadvantage of the database management
system. This is because, for DBMS, it is mandatory to have a high-
speed processor and also a large memory size. After all,
nowadays there is a large amount of data in every field which
needs to be store safely and with security.
2. Cost of Staff Training –
Educated staff (database administrator, application programmers,
data entry operations) who maintains the database management
system also requires a good amount.
3. Cost of Data Conversion –
We need to convert our data into a database management
system, there is a requirement of a lot of money as it adds to the
cost of the database management system.
2. Complexity:
As we all know that nowadays all companies are using the database
management system as it fulfills lots of requirements and also
solves the problem. But a problem arises, that is all this functionality
has made the database management system an extremely complex
software. For the proper requirement of DBMS, it is very important
to have a good knowledge of it by the developers, DBA, designers,
and also the end-users. This is because if any one of them does not
acquire proper and complete skills then this may lead to data loss or
database failure.
3. Currency Maintenance:
This is very necessary to keep your system current because
efficiency which is one of the biggest factors and needs to be
overlooked must be maximized. That is we need to maximize the
efficiency of the database system to keep our system current.
4. Performance:
The traditional file system is written for small organizations and for
some specific applications due to which performance is generally
very good. But for the small-scale firms, DBMS does not give a good
performance as its speed is very slow. As a result, some applications
will not run as fast as they could.
5. Frequency Upgrade/Replacement Cycles:
Nowadays in this world, we need to stay up-to-date about the latest
technologies, developments arriving in the market. Frequent
upgrade of the products is done by the DBMS vendors to add new
functionality to the systems. New upgrade versions of the software
often come bundled. Sometimes these updates also need hardware
upgrades.
6.Complex design :
Database design is complex, difficult and time consuming.
7.Damaged part : If one part of database is corrupted or
damaged, then entire
database may get affected.
8.Compatibility: DBMS software may not be compatible with other
software systems or platforms, making it difficult to integrate with
other applications.
9.Security: A DBMS can be vulnerable to security breaches if not
properly configured and managed. This can lead to data loss or
theft.
10.Data isolation: Because data are scattered in various files, and
files may be in different formats, writing new application programs
to retrieve the appropriate data is difficult.

Structure of Database Management


System
Database Management System (DBMS) is software that allows access to
data stored in a database and provides an easy and effective method of –
 Defining the information.
 Storing the information.
 Manipulating the information.
 Protecting the information from system crashes or data theft.
 Differentiating access permissions for different users.
Data Theft: When somebody steals the information stored on databases,
and servers, this process is known as Data Theft.
Note: Structure of Database Management System is also referred to as
Overall System Structure or Database Architecture but it is different from the
tier architecture of Database.
The database system is divided into three components: Query Processor,
Storage Manager, and Disk Storage. These are explained as following
below.
Architecture of DBMS

1. Query Processor: It interprets the requests (queries) received from end


user via an application program into instructions. It also executes the user
request which is received from the DML compiler.
Query Processor contains the following components –
 DML Compiler: It processes the DML statements into low level
instruction (machine language), so that they can be executed.
 DDL Interpreter: It processes the DDL statements into a set of table
containing meta data (data about data).
 Embedded DML Pre-compiler: It processes DML statements embedded
in an application program into procedural calls.
 Query Optimizer: It executes the instruction generated by DML Compiler.
2. Storage Manager: Storage Manager is a program that provides an
interface between the data stored in the database and the queries received.
It is also known as Database Control System. It maintains the consistency
and integrity of the database by applying the constraints and executing
the DCL statements. It is responsible for updating, storing, deleting, and
retrieving data in the database.
It contains the following components –
 Authorization Manager: It ensures role-based access control, i.e,.
checks whether the particular person is privileged to perform the
requested operation or not.

 Integrity Manager: It checks the integrity constraints when the database


is modified.

 Transaction Manager: It controls concurrent access by performing the


operations in a scheduled way that it receives the transaction. Thus, it
ensures that the database remains in the consistent state before and after
the execution of a transaction.

 File Manager: It manages the file space and the data structure used to
represent information in the database.

 Buffer Manager: It is responsible for cache memory and the transfer of


data between the secondary storage and main memory.

3. Disk Storage: It contains the following components –


 Data Files: It stores the data.

 Data Dictionary: It contains the information about the structure of any


database object. It is the repository of information that governs the
metadata.
 Indices: It provides faster retrieval of data item.
The structure of a Database Management System (DBMS) can be divided
into three main components: the Internal Level, the Conceptual Level, and
the External Level.
1. Internal Level: This level represents the physical storage of data in the
database. It is responsible for storing and retrieving data from the storage
devices, such as hard drives or solid-state drives. It deals with low-level
implementation details such as data compression, indexing, and storage
allocation.
2. Conceptual Level: This level represents the logical view of the database.
It deals with the overall organization of data in the database and the
relationships between them. It defines the data schema, which includes
tables, attributes, and their relationships. The conceptual level is
independent of any specific DBMS and can be implemented using
different DBMSs.
3. External Level: This level represents the user’s view of the database. It
deals with how users access the data in the database. It allows users to
view data in a way that makes sense to them, without worrying about the
underlying implementation details. The external level provides a set of
views or interfaces to the database, which are tailored to meet the needs
of specific user groups.
The three levels are connected through a schema mapping process that
translates data from one level to another. The schema mapping process
ensures that changes made at one level are reflected in the other levels.

Database Schemas
Nowadays data is one of the most important things in the business world,
every business captures its customers’ data to understand their behavior, in
the world of the internet, data is growing like crazy, so businesses need
more advanced database solutions, by which they can maintain the database
systems and whenever they need data to solve business problems, they can
easily get what data they want without any problem. To fulfill this condition,
there is a requirement for the database schema in the picture.
What is Schema?
 The Skeleton of the database is created by the attributes and this
skeleton is named Schema.
 Schema mentions the logical constraints like table, primary key, etc.
 The schema does not represent the data type of the attributes.

Details of a Customer
Schema of Customer

Database Schema
 A database schema is a logical representation of data that shows how
the data in a database should be stored logically. It shows how the data
is organized and the relationship between the tables.
 Database schema contains table, field, views and relation between
different keys like primary key, foreign key.
 Data are stored in the form of files which is unstructured in nature which
makes accessing the data difficult. Thus to resolve the issue the data are
organized in structured way with the help of database schema.
 Database schema provides the organization of data and the relationship
between the stored data.
 Database schema defines a set of guidelines that control the database
along with that it provides information about the way of accessing and
modifying the data.
Types of Database Schemas
There are 3 types of database schema:
Physical Database Schema
 A Physical schema defines, how the data or information is stored
physically in the storage systems in the form of files & indices. This is the
actual code or syntax needed to create the structure of a database, we
can say that when we design a database at a physical level, it’s called
physical schema.
 The Database administrator chooses where and how to store the data in
the different blocks of storage.
Logical Database Schema
 A logical database schema defines all the logical constraints that need to
be applied to the stored data, and also describes tables, views, entity
relationships, and integrity constraints.
 The Logical schema describes how the data is stored in the form of tables
& how the attributes of a table are connected.
 Using ER modelling the relationship between the components of the data
is maintained.
 In logical schema different integrity constraints are defined in order to
maintain the quality of insertion and update the data.
View Database Schema
 It is a view level design which is able to define the interaction between
end-user and database.
 User is able to interact with the database with the help of the interface
without knowing much about the stored mechanism of data in database.
Three Layer Schema Design

Creating Database Schema


For creating a schema, the statement “CREATE SCHEMA” is used in every
database. But different databases have different meanings for this. Below
we’ll be looking at some statements for creating a database schema in
different database systems:
1. MySQL: In MySQL, we use the “CREATE SCHEMA” statement for
creating the database, because, in MySQL CREATE SCHEMA and CREATE
DATABASE, both statements are similar.
2. SQL Server: In SQL Server, we use the “CREATE SCHEMA” statement
for creating a new schema.
3. Oracle Database: In Oracle Database, we use “CREATE USER” for
creating a new schema, because in the Oracle database, a schema is
already created with each database user. The statement “CREATE
SCHEMA” does not create a schema, instead, it populates the schema with
tables & views and also allows one to access those objects without needing
multiple SQL statements for multiple transactions.
Database Schema Designs
There are many ways to structure a database, and we should use the best-
suited schema design for creating our database because ineffective schema
designs are difficult to manage & consume extra memory and resources.
Schema design mostly depends on the application’s requirements. Here we
have some effective schema designs to create our applications, let’s take a
look at the schema designs:
1. Flat Model
2. Hierarchical Model
3. Network Model
4. Relational Model
5. Star Schema
6. Snowflake Schema
Flat Model
A flat model schema is a 2-D array in which every column contains the same
type of data/information and the elements with rows are related to each
other. It is just like a table or a spreadsheet. This schema is better for small
applications that do not contain complex data.

Designing Flat Model

Hierarchical Model
Data is arranged using parent-child relationships and a tree-like structure in
the Hierarchical Database Model. Because each record consists of several
children and one parent, it can be used to illustrate one-to-many
relationships in diagrams such as organizational charts. Although obvious, it
might not be as adaptable in complicated partnerships.
Designing Hierarchical Model

Network Model
The network model and the hierarchical model are quite similar with an
important difference that is related to data relationships. The network model
allows many-to-many relationships whereas hierarchical models allow one-
to-many relationships.

Designing Network Model

Relational Model
The relational model is mainly used for relational databases, where the data
is stored as relations of the table. This relational model schema is better for
object-oriented programming.
Designing Relational Model

Star Schema
Star schema is better for storing and analyzing large amounts of data. It has
a fact table at its center & multiple dimension tables connected to it just like a
star, where the fact table contains the numerical data that run business
processes and the dimension table contains data related to dimensions such
as product, time, people, etc. or we can say, this table contains the
description of the fact table. The star schema allows us to structure the data
of RDBMS.

Designing Star Schema


Snowflake Schema
Just like star schema, the snowflake schema also has a fact table at its
center and multiple dimension tables connected to it, but the main difference
in both models is that in snowflake schema – dimension tables are further
normalized into multiple related tables. The snowflake schema is used for
analyzing large amounts of data.

Designing Snowflake Schema

Difference between Logical and Physical Database Schema


Physical Schema Logical Schema

Physical schema describes the way of Logical schema provides the


storage of data in the disk. conceptual view that defines the
relationship between the data entities.

Having Low level of abstraction. Having a high level of abstraction.

The design of a database must work


The design of database is independent
with a specific database management
to any database management system.
system or hardware platform.
Physical Schema Logical Schema

Any changes made in logical schema


Changes in Physical schema effects
have minimal effect in the physical
the logical schema
schema

Physical schema does not include


Logical schema includes attributes.
attributes.

Physical schema contains the Logical schema does not contain any
attributes and their data types. attributes or data types.

Examples: Data definition Examples: Entity Relationship


language(DDL), storage structures, diagram, Unified Modeling Language,
indexes. class diagram.

Advantages of Database Schema


 Providing Consistency of data: Database schema ensures the data
consistency and prevents the duplicates.
 Maintaining Scalability: Well designed database schema helps in
maintaining addition of new tables in database along with that it helps in
handling large amounts of data in growing tables.
 Performance Improvement: Database schema helps in faster data
retrieval which is able to reduce operation time on the database tables.
 Easy Maintenance: Database schema helps in maintaining the entire
database without affecting the rest of the database
 Security of Data: Database schema helps in storing the sensitive data
and allows only authorized access to the database.
Database Instance
The database schema is defined before the actual database is created, after
the database is operational, it is very difficult to modify the schema because
the schema represents the fundamental structure of the database. Database
instance does not hold any information related to the saved data in
database. Therefore database instance represents the data and information
that is currently stored in the database at a specific point in time.
Database instance of Customer table at a specific time

Conclusion
 The Structure of the database is referred to as the Schema, and it
represents logical restrictions like Table and Key, among other things.
 Three Schema Architecture was developed to prevent the user from direct
access to the database.
 Since the information that is saved in the database is subject to frequent
change, Instance is a representation of a data at a specific time.

What is Data Independence in DBMS?


Data independence is a property of a database management system
by which we can change the database schema at one level of the
database system without changing the database schema at the next
higher level. In this article, we will learn in full detail about data
independence and will also see its types. If you read it completely,
you will understand it easily.
What is Data Independence in DBMS?
In the context of a database management system, data
independence is the feature that allows the schema of one layer of
the database system to be changed without any impact on the
schema of the next higher level of the database system. ” Through
data independence, we can build an environment in which data is
independent of all programs, and through the three schema
architectures, data independence will be more understandable. Data
via two card stencils along with centralized DBMS data is a form of
transparency that has value for someone.
Types of Data Independence
There are two types of data independence.
 logical data independence
 Physical data independence
Logical Data Independence
 Changing the logical schema (conceptual level) without changing
the external schema (view level) is called logical data
independence.
 It is used to keep the external schema separate from the logical
schema.
 If we make any changes at the conceptual level of data, it does
not affect the view level.
 This happens at the user interface level.
 For example, it is possible to add or delete new entities,
attributes to the conceptual schema without making any changes
to the external schema.
Physical Data Independence
 Making changes to the physical schema without changing the
logical schema is called physical data independence.
 If we change the storage size of the database system server, it
will not affect the conceptual structure of the database.
 It is used to keep the conceptual level separate from the internal
level.
 This happens at the logical interface level.
 Example – Changing the location of the database from C drive to
D drive.
Difference Between Physical and Logical Data Independence
Physical Data Independence Logical Data Independence

It mainly concerns how the data is stored It mainly concerns about changes to the
in the system. structure or data definition.

It is easier to achieve than logical It is difficult to achieve compared to


independence. physical independence.

To make changes at the physical level we To make changes at the logical level, we
generally do not require changes at the need to make changes at the application
application program level. level.

It tells about the internal schema. It tells about the conceptual schema.

There may or may not be a need for Whenever the logical structure of
changes to be made at the internal level to the database has to be changed, the changes
improve the structure. made at the logical level are important.

Example- change in compression


Example – adding/modifying or deleting a
technology, hashing algorithm, storage
new attribute.
device etc.

Conclusion
The data independence property of the database is an expected
property that relies on separating the logical and physical aspects of
storing and accessing data. This means that it is easy to make
structural modifications to the database without affecting the
applications that use it. This is a situation that impacts the capacity
of the organization to remain adaptable in the dynamic business
environment, as well as making sure that the technological
advancements within the organization are interoperable over a long
period of time.

Database Languages in DBMS


Databases are used to store information. The Database is related to both
software and hardware here The Software is used for accessing the data in
the form of Software applications, and The Hardware is used for storing the
data in the memory or hard disk.
Any Database provides an interface between the end user and the database
by using this interface, the end user can access the database data. It is a
very secure means before accessing database data we need to authenticate
first, and then we get access to the database. We have different types of
Database Languages which are represented in the below image.

output

Types of Database Languages in DBMS


Now I will explain Database Languages namely DDL, DCL,
DML, and TCL. Each category language is used for a different purpose
Below I explain each category with proper examples.
DDL (Data Definition Language)
 The DDL stands for Data Definition Language , Which is used for define
the database’s internal structure and Pattern of the Database.
 Basically, The DDL is used for creating tables, indexes, constraints, and
schema in the Database.
 By using DDL statements we can able to create the architecture of the
required database.
Below I list out types of database commands that are used in DDL. By using
those queries we can able to perform the DDL on the Database.
 Create It is used to create objects in the database
 Alter It is used for change or alter the structure of the database objects
 Drop It is used for delete objects from the database
 Truncate It is used for remove all records from a table
 Rename It is used to rename the object in database
 Comment It is used for comment on the data dictionary.
Now I will explain each command with example for better understanding the
concepts.
Create
It is one the command in DDL which is used for creating objects in database
means creating Tables, Users, Triggers, functions and other objects. Here I
will show how to create a table by using create command from DDL.
Syntax:
CREATE TABLE Students (
column1 INT,
column2 VARCHAR(50),
column3 INT
);
Example:

create table

Alter
It is one the command in DDL which is used for change or alter the structure
of the database or table. I already created students table with some columns
you can see in the above image. Now by using Alter command I add new
column that weight to the students table.
Syntax:
ALTER TABLE Students ADD column_name;
Example:

Alter command

Drop
This Drop command is used for delete objects from the database. In this
example I drop the students table
Syntax:
DROP Table Table_name;
Example:

drop

Truncate
Truncate command is used for remove all records from a table. Now I
remove rows from the Student table.
Syntax:
TRUNCATE TABLE table_name;
Example:

truncate

Rename
It is used to rename the object in database. Now I rename the table
from students to ClassMembers. Below I provide the example for better
understanding.
Syntax:
ALTER TABLE Old_Table_Name RENAME TO New_Table_Name;
Example:

Rename

Comment
It is used for comment on the data dictionary. We have two different
comments namely Single line comment and Multi-line comments.
Single Line
-- This is a single-line comment
Multi-line comment
/*
This is a
multi-line comment
*/
DCL (Data Control Language)
The DCL stands for Data Control Language means these commands are
used to retrieve the saved data from database. And one more thing is the
DCL execution is Transactional that means It have roll back parameters. we
have two tasks under the Data Control Language below I listed them
 Grant It is used for give user access to the database
 Revoke It is used for to take back the access or permissions from the
user
Now I will explain these commands with proper examples for better
understanding
Grant
Basically The grant command is used for provide database access to the
new user. Here I create one user then I give the access to the database.
Syntax:
GRANT privileges
ON object
TO user_or_role [WITH GRANT OPTION];
Example:
GRANT SELECT, INSERT ON students TO user;
Revoke
The Revoke command is used to to take back database access from the
user. Now I provide the example in the below
Syntax:
REVOKE privileges ON object FROM user_or_role;
Example:
REVOKE ALL PRIVILEGES ON students FROM user;
DML (Data Manipulation Language)
The Data Manipulation Language is used to Manipulate the data in the
database by using different commands. In this category we can able to
perform Insert new data into Table, Update existing data in the Table, Delete
Data from the Table and other functions we can perform on data by using
these DML commands. Below I listed those commands for your reference
 Select It is used for select data from the Table based on the requirements
 Insert It is sued for Inserting data into existing table
 Update It is used for update data in the Table based on the requirement
 Delete It is used for delete data from the Table
 Merge It is used for upsert operations
 Call It is used for call a structured query language or Java sub program
 Lock Table It have ability to control the concurrency
Now I will explain each command with proper example for better
understanding the concept.
Select
The Select command is used for select required data based on conditions
from a existing Table. Here I select all data from the ClassMembers Table.
Syntax:
SELECT * FROM Table_Name
Example:

Select Command

Insert
The Insert command is used for inserting new data into Table. Now I insert a
new data into ClassMembers Table. Below I provide the example.
Syntax:
INSERT INTO Table_Name (Column 1, Column 2, Column 3, Column 4)
VALUES (Value 1, Value 2,Value 3, Value 4);
Example:

Insert command

Update
The Update command is used for update information In the Table. Now I will
update name John Doe to Roman in the ClassMemebers Table. Below I
provide that Example you can update any row or columns data.
Syntax:
UPDATE Table_Name SET Name = 'New_Value' WHERE Name =
'Ola_Value';
Example:

Update

Delete:
The Delete command is used for delete data from the Table. Here I delete
Student Id with 2 from the ClassMembers. Below I provide the Example for
your reference.
Syntax:
DELETE FROM Table_Name WHERE Column = Value;
Example:

Delete Command
Merge
The Merge command is used for perform upsert operation means It inserts
rows that doesn’t exist and updates rows that do.
Example:
MERGE INTO target_table AS target
USING source_table AS source
ON (target.id = source.id)
WHEN MATCHED THEN
UPDATE SET target.name = source.name
WHEN NOT MATCHED THEN
INSERT (id, name) VALUES (source.id, source.name);
CALL
The Call command is used for call the user defined functions
Example:
CALL user_defined_function(parameter 1, parameter 2);
LOCK TABLE
The lock table command is used for lock the table for preventing access from
the others for same Table
Syntax:
LOCK TABLE your_table IN EXCLUSIVE MODE;
Example:
LOCK TABLE ClassMembers IN EXCLUSIVE MODE;
TCL ( Transaction Control Language )
The TCL full form is Transaction Control Language commands are used to
run the changes made by the DML commands And one more thing is TCL
can be grouped into a logical transaction. And We have two different
commands in this category below I listed them for reference.
 Commit It is used for save the transaction on the Database. And these
very useful in banking sectors.
 Rollback It is used for restore the database to original state from last
commit. This command also plays an important role in Banking Sectors.
Now I will explain these two commands for your reference. And I provide
proper examples below I provide those example
Commit
The Commit command is used for save the transaction in the database and
changes are made by the DML statements. Now I will provide the example
below Here I used ClassMembers Table. Here I inserted a new data into
Table then I commit It.
Syntax:
Database Operation
Commit
Example:

commit

ROLLBACK
Rollback command is used for restore the database to original state from last
commit. Here I provide the example and in this I already commit the you can
see in the above, Now I delete one row from the Table then again rollback
the previous database state.
Syntax:
ROLLBACK;
Example:

rollback

Conclusion
In this article I will explained Database Languages In Database which are
used for different purposes. We have DDL, DCL, DML, TCL these are
different categories. The DDL language is used for used for define the
database internal structure and Pattern of the Database. And the DCL
commands are used to control the data from the user means It can provide
control on the Database, Table and Data. The DML commands are used to
manipulate the Data in Table like Inserting, updating, deleting of the Data
finally the TCL commands are used to save and restore the previous state of
Database.

Classification of Database Management System


Database Management Systems (DBMS) can be classified based on various criteria such as data
model, usage, number of users, architecture, and storage location. Here is a detailed classification
of DBMS:

1. Classification by Data Model

a. Hierarchical DBMS:

 Structure: Organizes data in a tree-like structure.


 Example: IBM Information Management System (IMS).
 Use Case: Suitable for applications with a clear hierarchical structure, such as organizational
charts.

b. Network DBMS:

 Structure: Organizes data in a graph structure, allowing many-to-many relationships.


 Example: Integrated Data Store (IDS), IDMS.
 Use Case: Suitable for complex relationships, such as telecommunications networks.

c. Relational DBMS (RDBMS):

 Structure: Uses tables to represent data and relationships.


 Example: MySQL, PostgreSQL, Oracle, Microsoft SQL Server.
 Use Case: General-purpose databases, web applications, enterprise applications.

d. Object-oriented DBMS (OODBMS):

 Structure: Stores data in objects, similar to object-oriented programming.


 Example: ObjectDB, db4o.
 Use Case: Applications requiring complex data representations, such as CAD/CAM, multimedia
systems.

e. Object-Relational DBMS (ORDBMS):

 Structure: Combines features of both relational and object-oriented databases.


 Example: PostgreSQL, Oracle.
 Use Case: Applications needing relational databases with object-oriented features.

f. NoSQL DBMS:
 Structure: Non-relational and can handle various data formats.
 Types:
o Document Stores: MongoDB, CouchDB.
o Key-Value Stores: Redis, DynamoDB.
o Column Stores: Cassandra, HBase.
o Graph Databases: Neo4j, Amazon Neptune.
 Use Case: Big data, real-time web applications, social networks.

2. Classification by Usage

a. Online Transaction Processing (OLTP):

 Characteristics: Manages transaction-oriented applications.


 Example: Banking systems, order processing systems.

b. Online Analytical Processing (OLAP):

 Characteristics: Handles complex queries and data analysis.


 Example: Data warehousing, business intelligence applications.

3. Classification by Number of Users

a. Single-User DBMS:

 Characteristics: Supports one user at a time.


 Example: Microsoft Access.
 Use Case: Personal databases, small-scale applications.

b. Multi-User DBMS:

 Characteristics: Supports multiple users simultaneously.


 Example: MySQL, Oracle.
 Use Case: Enterprise applications, web applications.

4. Classification by Architecture

a. Centralized DBMS:

 Characteristics: All data stored in a single location.


 Example: Mainframe systems.
 Use Case: Applications with centralized control.

b. Distributed DBMS:

 Characteristics: Data distributed across multiple locations.


 Example: Google Cloud Spanner, Apache Cassandra.
 Use Case: Applications requiring high availability and geographic distribution.

c. Client-Server DBMS:

 Characteristics: Clients request services from a centralized server.


 Example: Microsoft SQL Server, Oracle.
 Use Case: Web applications, enterprise environments.

d. Cloud DBMS:

 Characteristics: Database services provided over the cloud.


 Example: Amazon RDS, Google Cloud SQL.
 Use Case: Scalable and flexible database solutions.

5. Classification by Storage Location

a. In-Memory DBMS:

 Characteristics: Stores data in memory for faster access.


 Example: SAP HANA, Redis.
 Use Case: Real-time analytics, caching solutions.

b. Disk-Based DBMS:

 Characteristics: Stores data on physical disks.


 Example: Traditional RDBMS like Oracle, MySQL.
 Use Case: General-purpose databases.

You might also like