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

Unit I_Database Management System

The document provides an overview of Database Management Systems (DBMS), explaining the concepts of data, information, and knowledge, as well as the structure and organization of data within databases. It details various data types, file organization methods, and the advantages and disadvantages of using DBMS compared to traditional file systems. Additionally, it outlines the three levels of data abstraction and the applications of databases in various sectors.

Uploaded by

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

Unit I_Database Management System

The document provides an overview of Database Management Systems (DBMS), explaining the concepts of data, information, and knowledge, as well as the structure and organization of data within databases. It details various data types, file organization methods, and the advantages and disadvantages of using DBMS compared to traditional file systems. Additionally, it outlines the three levels of data abstraction and the applications of databases in various sectors.

Uploaded by

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

Database Management

System
• Data

• Data is the raw material that can be processed for any computing machine.

For example − Employee name, Product name, Name of the student, Marks of the student, Mobile
number, Image etc.

• Information

• Information is the data that has been converted into more useful or intelligent form.

For example: Report card sheet.


The information is needed for the following reasons −

• To gain knowledge about the surroundings.

• To keep the system up to date.

• To know about the rules and regulations of the society.

• Knowledge

• The human mind purposefully organizes the information and evaluates it to produce knowledge.

Example of data, information and knowledge

• A student secures 450 marks. Here 450 is data, marks of the student is the information and hard work required to
get the marks is knowledge.
Data Information

Data is the raw fact. It is a processed form of data.

It is not significant to a business. It is significant to a business.

Data is an atomic level piece of It is a collection of data.


information.

Example: Product name, Name of student. Example: Report card of student.

It is a phenomenal fact. It is organized data.

This is the primary level of intelligence. It is a secondary level of intelligence.

May or may not be meaningful. Always meaningful.

Understanding is difficult. Understanding is easy.


• Use of data and information in database
• Data are logically organized into:

• 1. Bits (characters)

• 2. Fields

• 3. Records

• 4. Files

• 5. Databases
• Bit (Character) - a bit is the smallest unit of data representation (value of a bit may be a 0
or 1). Eight bits make a byte which can represent a character or a special symbol in a
character code.

• Field - a field consists of a grouping of characters. A data field represents an attribute (a


characteristic or quality) of some entity (object, person, place, or event).

• Record - a record represents a collection of attributes that describe a real-world entity.

• File - a group of related records. Files are frequently classified by the application for which
they are primarily used (employee file).

• Database – It is an integrated collection of logically related records or files.


Data Types used in Database
• Scalar data types : – Used to store scalar values like numbers, decimals, characters,
date etc.

• Composite data types : – It is combination of other datatypes usually scalar datatypes.

• Reference data types : – Used to store the information about another datatype. It can
be referred as pointers in C.

• LOB data types : – Used to store large objects like images, videos etc

• Unknown Column types : – when column types are not known, this datatype is used.

• User Define data types : – These datatypes are defined by the developer while coding
using the above base datatypes.
Scalar data types
• Character Data type: –This type of datatype is used to store alpha-numeric
values like alphabets as well as numbers and special characters.
• Example:
• CREATE TABLE STUDENT (STD_NAME CHAR (15), ADDRESS VARCHAR2 (50));

• Numeric Datatypes: – Stores different types of numeric data – numbers,


decimals etc.
• Example:
• CREATE TABLE STUDENT (STD_ID NUMBER (8), ADDRESS VARCHAR2 (50));
• Date / Time Datatypes: – These datatypes are used to store date and
timestamps in the columns and variables.

• Boolean Datatypes: – It is used to store boolean values – TRUE or FALSE.


• What is Database
• The database is a collection of inter-related data which is used to retrieve,
insert and delete the data efficiently.
• It is also used to organize the data in the form of a table, schema, views, and
reports, etc.
• For example: The college Database organizes the data about the admin, staff,
students and faculty etc.

• Database Management System


• Database management system is a software which is used to manage the
database.
• For example: MySQL,
• Need of database/ purpose of database system
• A database is a collection of data, usually stored in electronic form.
• It is easy to store and access information using database.

• Manages large amounts of data


• A database stores and manages a large amount of data on a daily basis.

• Accurate
• A database is pretty accurate as it has all sorts of build in constraints, checks etc.
e.g. UNIQUE constraints, CHECK constraints.

• Easy to update data


• In a database, it is easy to update data using various Data Manipulation languages
(DML) available. One of these languages is SQL.
• Security of data
• Databases have various methods to ensure security of data.
• There are user logins required before accessing a database and various access
specifiers.
• These allow only authorised users to access the database.
• Data integrity
• This is ensured in databases by using various constraints for data.
• Data integrity in databases makes sure that the data is accurate and consistent in
a database.
• Integrity constraints are pre-defined set of rules that are applied on the table
fields(columns) to ensure that the overall validity, integrity, and consistency of the
data present in the database table is maintained.
• Easy to research data
• It is very easy to access and research data in a database.
• Using Data Query Languages (DQL) user can search any data in the database and
perform computations on it.
Database Applications:
• Banking: transactions
• Airlines: reservations, schedules
• Universities: registration, grades
• Sales: customers, products, purchases
• Online retailers: order tracking, customized recommendations
• Manufacturing: production, inventory, orders, supply chain
• Human resources: employee records, salaries, tax deductions
• Databases can be very large.
• Databases touch all aspects of our lives
University database example
• Application program examples
• Add new students, instructors, and courses
• Register students for courses, and generate class rosters
• Assign grades to students, compute grade point averages (GPA) and generate transcripts
• In the early days, database applications were built directly on top of file systems
File System
• The file system is basically a way of arranging the files in a storage medium like a hard disk.

• The file system organizes the files and helps in the retrieval of files when they are required.

• File systems consist of different files which are grouped into directories.

• The directories further contain other folders and files.

• Example: NTFS(New Technology File System), EXT(Extended File System).


File System
Physical Files
• Physical files contain the actual data that is stored on system, and a description
of how data is to be presented to or received from a program.

• They contain only one record format and one or more members.

• Records in database files can be described using either a field-level description


or a record-level description.
• A field-level description describes the fields in the record to the
system.

• A record-level description describes only the length of the record,


and not the contents of the record.

• Database files that are created with field-level descriptions are


referred to as externally described files.

• Database files that are created with record-level descriptions are


referred to as program-described files.
Logical Files
• Logical files do not contain data.
• They contain a description of records that are found in one or more
physical files.
• A logical file is a view or representation of one or more physical files.
File Organization
• File Organization defines how file records are mapped onto disk
blocks.

• Storing the files in a certain order is called File Organization.

• It helps in the faster selection of records, it makes the process faster.

• Different Operations like inserting, deleting, and update on different


records are faster and easier.

• It prevents us from inserting duplicate records via various operations.


Types of File Organization
Some types of File Organizations are :
• Sequential File Organization
• Heap File Organization
• Hash File Organization
Sequential File Organization
• The easiest method for file Organization is the Sequential method.
• In this method, the file is stored one after another in a sequential
manner. There are two ways to implement this method:
1. Pile File Method
This method is quite simple, in which we store the records in a
sequence i.e. one after the other in the order in which they are inserted
into the tables.
• Insertion of the new record: Let the R1, R3, and so on up to R5 and
R4 be four records in the sequence.
• Suppose a new record R2 has to be inserted in the sequence, then it is
simply placed at the end of the file.
2)Sorted File Method
• In this method, a new record has to be inserted, it is always inserted
in a sorted (ascending or descending) manner.
• The sorting of records may be based on any primary key or any other
key.
Insertion of the new record:
• Let us assume that there is a preexisting sorted sequence of four
records R1, R3, and so on up to R7 and R8.
• Suppose a new record R2 has to be inserted in the sequence, then it
will be inserted at the end of the file and then it will sort the
sequence.
Heap File Organization
• It works with data blocks.
• In this method, records are inserted at the end of the file, into the data blocks.
• No Sorting or Ordering is required in this method.
• If a data block is full, the new record is stored in some other block
• Insertion of the new record: Suppose we have four records in the heap R1, R5,
R6, R4, and R3, and suppose a new record R2 has to be inserted in the heap
then, since the last data block i.e data block 3 is full it will be inserted in any of
the data blocks selected by the DBMS, like data block 1.
• Hash File Organization:
• Data bucket – Data buckets are the memory locations where the records are
stored.
• These buckets are also considered as Unit Of Storage.

• Hash Function – Hash function is a mapping function that maps all the set of
search keys to actual record address.

• Hash Index-The prefix of an entire hash value is taken as a hash index.


• Static Hashing:
• In static hashing, when a search-key value is provided, the hash function always
computes the same address.

• For example
• if we want to generate an address for STUDENT_ID = 104 using mod (5) hash
function, it always results in the same bucket address 4.
• There will not be any changes to the bucket address here.

• A number of data buckets in the memory for this static hashing remain constant
throughout.
• Insertion – When a new record is inserted into the table, The hash function h
generates a bucket address for the new record based on its hash key K.

• Searching – When a record needs to be searched,


• The same hash function is used to retrieve the bucket address for the record.
• Dynamic Hashing –
• The drawback of static hashing is that it does not expand or shrink dynamically
as the size of the database grows or shrinks.
• In Dynamic hashing, data buckets grows or shrinks (added or removed
dynamically) as the records increases or decreases.
• Dynamic hashing is also known as extended hashing.
• In dynamic hashing, the hash function is made to produce a large number of
values.
• For Example,
• there are three data records D1, D2 and D3 . The hash function generates three
addresses 1001, 0101 and 1010 respectively.
• This method of storing considers only part of this address – especially only first
one bit to store the data. So it tries to load three of them at address 0 and 1.

• The problem is that No bucket address is remaining for D3.
• The bucket has to grow dynamically to accommodate D3.
• So it changes the address have 2 bits rather than 1 bit, and then it updates the
existing data to have 2 bit address.
• Then it tries to accommodate D3.

• DBMS(Database Management System) :

• Database Management System is basically software that manages the collection


of related data.
• It is used for storing data and retrieving the data effectively when it is needed.
• It also provides proper security measures for protecting the data from
unauthorized access.
• In Database Management System the data can be fetched by SQL queries and
relational algebra.
• It also provides mechanisms for data recovery and data backup.
Difference between File system and DBMS

Basics File System DBMS

The file system is a way of arranging the


DBMS is software for managing the
Structure files in a storage medium within a
database.
computer.

Redundant data can be present in a file


Data Redundancy system. In DBMS there is no redundant data.

Backup and It doesn’t provide backup and recovery It provides backup and recovery of data
Recovery of data if it is lost. even if it is lost.
Query There is no efficient query Efficient query processing is there in
processing processing in the file system. DBMS.

There is more data consistency


Consistency There is less data consistency in the because of the process of
file system. normalization.

Complexity It is less complex as compared to It has more complexity in handling


DBMS. as compared to the file system.

DBMS has more security


Security File systems provide less security in mechanisms as compared to file
Constraints comparison to DBMS. systems.
Cost It is less expensive than DBMS. It has a comparatively higher cost
than a file system.

Data There is no data independence. In DBMS data independence


Independence exists.

User Access Only one user can access data at a Multiple users can access data at a
time. time.

Meaning The user not required to write The user has to write procedures
procedures. for managing databases
Data is distributed in many Due to centralized nature
Sharing files. So, not easy to share sharing is easy
data

It give details of storage and It hides the internal details of


Data Abstraction representation of data Database

Integrity Constraints are Integrity constraints are easy


Integrity Constraints difficult to implement to implement

To access data in a file , user No such attributes are


Attributes requires attributes such as file required.
name ,file location.

Example Cobol, C++ Oracle, SQL Server


• Advantages of DBMS
• Controls database redundancy: It can control data redundancy because it stores
all the data in one single database file and that recorded data is placed in the
database.
• Data sharing: In DBMS, the authorized users of an organization can share the
data among multiple users.
• Easily Maintenance: It can be easily maintainable due to the centralized nature of
the database system.
• Reduce time: It reduces development time and maintenance need.
• multiple user interface: It provides different types of user interfaces like graphical
user interfaces, application program interfaces
• Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and and software failures and restores the data if
required.
• Disadvantages of DBMS
• Cost of Hardware and Software: It requires a high speed of data processor and
large memory size to run DBMS software.
• Size: It occupies a large space of disks and large memory to run them efficiently.
• Complexity: Database system creates additional complexity and requirements.
• Higher impact of failure: Failure is highly impacted the database because in
most of the organization, all the data stored in a single database and if the
database is damaged due to electric failure or database corruption then the
data may be lost forever.
Three Levels of Data
Abstraction
1)Physical Level
• This is the lowest level in the three level architecture.

• It is also known as the internal level.

• The physical level describes how data is actually stored in the database.

• In the lowest level, this data is stored in the external hard drives in the form of
files and folders.
2)Conceptual Level
• The conceptual level is at a higher level than the physical level.

• It is also known as the logical level.

• It describes how the database appears to the users conceptually and the
relationships between various data tables.

• The conceptual level does not care for how the data in the database is actually
stored.
3)External Level
• This is the highest level in the three level architecture and closest to the user.

• It is also known as the view level.

• View is virtual table based on another table.

• The external level only shows the relevant database content to the users in
the form of views and hides the rest of the data.

• So different users can see the database as a different view as per their
individual requirements.
Database users
• Any person who uses a database and avails benefits from the database is
known as database user in DBMS.

• Database users in DBMS can access the database and retrieve the data from
the database using applications and interfaces provided by the Database
Management System.

• We can always provide security to our database from being accessed by the
unauthorized users.

• Different database users with different login IDs and passwords can only have
unrestricted access to that part of the database
• Database Administrators (DBA)
• Database Designers
• System Analysts
• Application Programmers / Back-End Developers
• Naive Users / Parametric Users
• Sophisticated Users
• Casual Users / Temporary Users
• Database Administrators (DBA)
• Database Administrators (DBA) are the most important type of database users in
DBMS.

• Database Administrator is an individual or a team of users who define the database


schema and takes charge of controlling various levels of the database within the
organization.

• Database Administrators (DBAs) have full control of the database and they are
sometimes known as the super-users of the database.

• Database Administrators (DBAs) can grant or revoke authorization permission to all


other users at any point of time.

• In order to access the database, DBAs have to provide login credentials (account ID
• Database Designers
• Database Designers are the users in DBMS who design and create the structure
of the database including triggers, indexes, schemas, entity relationships,
tables, constraints, etc. which complete the database.

• Database designers try to gather information depending upon the


requirements related to the database like the layout, looks, database
functioning, costing, technologies to be used & implementation techniques

• Database Designers are the type of database users in DBMS who are
responsible for implementing the overall design of the database.
• Naïve Users
• Naive users also known as Parametric End users, don't have any knowledge of
DBMS but still frequently use the database applications to get the desired
results.

• With the help of the interface provided by the DBMS applications, Naive
users mostly use the database to fill in or retrieve the information

• In simple terms, Naive / Parametric End users work directly on developed


applications to access the database indirectly for getting the desired results.

• For example: Railway ticket booking users in general are naive/parametric end
users as they don't have much knowledge about DBMS and directly use railway
booking application to book their tickets.
• System Analysts
• System Analysts are the type of database users in DBMS who analyze the
requirements of Naive / Parametric End users.

• It is their responsibility to check whether all the requirements of end users


are satisfied or not.

• Analyzing feasibility, economic and technical aspects are some of the major
responsibilities for a system analyst in DBMS.

• They usually check and gather all the necessary information related to the
database, and if needed, they can change or update the final layout of the
database as per requirements
• Application Programmers
• Application Programmers also known as Back-End Developers, are computer
professional users who are responsible for developing the application
programs (C, C++, Java, PHP, Python, etc.)

• Application Programmers have deep knowledge of DBMS & databases and


know everything in detail.

• They interact with the database using DML (Data Manipulation Language)
queries to store data inside the database and when needed, they can also fetch
the data from it.
• Sophisticated users
• Sophisticated users are the type of database users in DBMS who know DBMS (DDL &
DML commands) and are familiar with the database.

• Sophisticated users can be business analysts, engineers, scientists, system analysts etc.

• These users are also known as SQL programmers as they can interact with the database
directly using SQL queries, query processors.

• Using SQL queries, they can fetch the data from the database. They can also delete,
update or insert new data into the database.

• For example: Data Engineers & Developers who are familiar with the database, directly
access the database using SQL queries rather than writing programming code for
accessing the database again. Hence, they are termed as sophisticated users.
• Casual users
• Casual users also known as temporary users, are the type of database users in
DBMS who frequently or occasionally use the database services.

• Whenever these users try to access the database, they want all the
information sorted in place.

• Casual/Temporary users have little knowledge about DBMS and each time
they try to access the database, they require new information.

• For example: High-level management people are casual users who have little
knowledge about DBMS and hence, they can access the database to either fill
in new information or retrieve existing results.
• Data independence
• Data independence is the ability to modify the schema without affecting the
programs and the application to be rewritten.

• Data is separated from the programs, so that the changes made to the data
will not affect the program execution and the application.

• There are two levels of data independence based on three levels of


abstraction.

• Physical Data Independence

• Logical Data Independence


• Physical Data independence
• Physical Data Independence means changing the physical level without
affecting the logical level or conceptual level.

• Using this property, we can change the storage device of the database without
affecting the logical schema.
• The changes in the physical level may include changes using the following −
• A new storage device like magnetic tape, hard disk, etc.

• A new data structure for storage.

• A different data access method or using an alternative files organization


technique.

• Changing the location of the database.


• Logical Data independence
• Logical view of data is the user view of the data.

• It presents data in the form that can be accessed by the end users.

• Codd’s Rule of Logical Data Independence says that users should be able to
manipulate the Logical View of data without any information of its physical
storage.
• Software or the computer program is used to manipulate the logical view of
the data.

• Database administrator is the one who decides what information is to be kept


in the database and how to use the logical level of abstraction.

• It provides the global view of Data.

• It also describes what data is to be stored in the database along with the
relationship.
• Characteristics of DBMS
• 1. Real World Entity
• The Database can store information such as the cost of vegetables, milk, bread,
etc.
• In DBMS (Database Management System), the entities look like real-world
entities.

• For example, if we want to create a student database, we need some entity. Any
student stores their data.
• Characteristics of DBMS
• 2. Self-explaining nature
• In DBMS (Database Management System), the Database contains another
database, and another database also contains metadata.

• Here the term metadata means data about data.

• For example, in a school database, the total number of rows and the table's
name are examples of metadata.
• Characteristics of DBMS
• 3. Atomicity of Operations (Transactions)
• atomicity means either the operation should be performed or not performed.
i.e., it should complete the operation on 0% or 100%.

• Here DBMS (Database Management System) provides atomicity as a


characteristic. This is the most important and useful characteristic of the DBMS
• Characteristics of DBMS
• 4. Concurrent Access without Anomalies
• Here the term anomalies mean multiuser can access the Database and fetch the
information without any problem.

• Example
• Ramesh give his ATM card to his sister Archita and tell her to withdraw 5000
from the ATM. At the same time, Ramesh transferred 2000 rupees to his brother
Monu. At the same time, both operations perform successfully.
• Characteristics of DBMS
• 5. Stores Any Kind of Structured Data
• The Database has the ability to store the data in a structured format.

• Database has the ability to store an unlimited amount of data.

• DBMS has the ability to store any type of data that exists in the real world, and
these data are structured way.
• Characteristics of DBMS
• 6. Ease of Access

• In DBMS, we can search any kind of stored data by applying a simple search
operation query.
• It is so much faster than manual searching.
• Capabilities of good DBMS

• Data Storage
• Data Retrieval
• Data Update
• Data Security
• Data Independence
• Data redundancy
• Data backup
• Data consistency
• Data integration
• Data Integrity
• Here the term integrity means the data should be correct and consistent in
nature.

• Example:
• There is a bank named ABC bank, and ABC bank has its own Database for the
storage of its customer data. If we try to enter the account details of ABC bank
and the account details are not available in the bank, then the Database gives
the incorrect output. However, if a customer changes their address but the new
address is not updated in the Database, it is called data inconsistency.
Data Security
• The Database should be accessible to the users in a limited way.

• The access to make changes to a database by the user should be limited, and
the users must not be given complete access to the entire Database.

• Unauthorized users should not be allowed to access the Database.


• Structure of DBMS
• The database system is divided into three components: Query Processor,
Storage Manager, and Disk Storage.
• 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.
• 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.

You might also like