21IT304 Notes-1
21IT304 Notes-1
Rajam, AP REV.:00
(AnAutonomousInstitutionAffiliatedtoJNTUGV,AP)
1. Objective
❖ To impact the knowledge of the Database management system and its domain.
CognitiveLearningLevels
Knowledge
Remember Understand Apply Analyse Evaluate Create
Dimension
Factual A,B
Conceptual C,D
Procedural
MetaCognitive
4. Teaching Methodology
❖
5. Evocation
6. Deliverables
Lecture1:
Introduction to DBMS
Data: Data refers to the raw facts and figures, or you can also call it unprocessed information; like a random number,
name or location, etc.
Information: And information is just the opposite of data, it concludes processed facts, which are effectively
organized and have got meaning.
Data Vs Information
• Data is a raw and unorganized fact that is required to be processed to make it meaningful whereas Information
is a set of data that is processed in a meaningful way according to the given requirement.
• Data does not have any specific purpose whereas Information carries a meaning that has been assigned by
interpreting data.
• Data measured in bits and bytes, on the other hand, Information is measured in meaningful units like time,
quantity, etc.
• Data can be structured, tabular data, graph, data tree whereas Information is language, ideas, and thoughts
based on the given data.
What is a Database?
• A database is an organized collection of data, so that it can be easily accessed and managed.
• You can organize data into tables, rows, columns, and index it to make it easier to find relevant information.
• 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.
• Using the database, you can easily retrieve, insert, and delete the information.
• 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.
• For example: MySQL, Oracle, etc are a very popular commercial database which is used in different
applications.
• DBMS provides an interface to perform various operations like database creation, storing data in it, updating
data, creating a table in the database and a lot more.
• There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix, PostgreSQL, SQL
Server, etc.
Lecture 2
Differences between FileSystem to DBMS
•
Lecture 3:
Database System Architecture
The typical structure of DBMS is based on Relational data model.
• The top part of the architecture shows application interfaces used by naive users, application programs created
by application programmers, query tools used by sophisticated users and administration tools used by database
administrator.
• The Middle two parts(Query processor and storage manager) are important components of database
architecture.
Query processor:
The interactive query processor helps the database system to simplify and facilitate access to data.
It consists of DDL(Data Definition Language) interpreter, DML(Data Manipulation Language) compiler and query
evaluation engine.
DDL interpreter: This is basically a translator which interprets the DDL statements in data dictionaries.
DML compiler: It translates DML statements query language into an evaluation plan.
This plan consists of the instructions which query evaluation engine understands.
Query evaluation engine: It executes the low-level instructions generated by the DML compiler.
When a user issues a query, the parsed query is presented to a query optimizer, which uses information about how the
data is stored to produce an efficient execution plan for evaluating the query.
Storage manager:
Storage manager is the component of database system that provides interface between the low level data stored in the
database and the application programs and queries submitted to the system.
The storage manager is responsible for storing, retrieving, and updating data in the database. The storage manager
components include
Authorization and integrity manager: Validates the users who want to access the data and tests for integrity
constraints.
Transaction manager: Ensures that the database remains in consistent despite of system failures and concurrent
transaction execution proceeds without conflicting.
File manager: Manages allocation of space on disk storage and representation of the information on disk.
Buffer manager: Manages the fetching of data from disk storage into main memory. The buffer manager also decides
what data to cache in main memory. Buffer manager is a crucial part of database system.
Indices: Indices are used to provide fast access to data items present in the database
DBMS Architecture
DBMS architecture depends upon how users are connected to the database to get their request done.
1-Tier Architecture
• It means the user can directly sit on the DBMS and uses it.
• Any changes done here will directly be done on the database itself.
• The 1-Tier architecture is used for development of the local application, where programmers can directly
communicate with the database for the quick response.
2-Tier Architecture
• In the two-tier architecture, applications on the client end can directly communicate with the database at the
server side.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like: query processing and transaction
management.
• To communicate with the DBMS, client-side application establishes a connection with the server side.
3-Tier Architecture
• The 3-Tier architecture contains another layer between the client and server.
• The application on the client-end interacts with an application server which further communicates with the
database system.
• End user has no idea about the existence of the database beyond the application server.
• The database also has no idea about any other user beyond the application.
• In simple terms, if we understand, 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 (DBMS).
• Database users in DBMS can be categorized based on their interaction with the databases.
• According to the tasks performed by the database users on the databases, we can categorize them into seven
categories as follows:
• 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 and password) to all other
users when required.
• Database Administrators (DBAs) are solely responsible for providing security to the database by restricting
unauthorized users from accessing the database.
• Database Administrators (DBAs) have all the privileges allowed by the DBMS.
• They have to update the database timely in terms of technology, functionality, and workflow in order to meet
future requirements and in making the database ready for future scope.
• Database Administrators (Database admins) are also responsible to keep a check on data integrity, data
consistency, data redundancy, hardware and software installation requirements, and routine maintenance of the
databases.
• They are also responsible for handling data loss, which can be caused due to any error or even due to system
failures.
• Database Administrators (DBAs) monitor the backup & recovery of the database records and provide technical
support as well.
2. Database Designers
• As the name suggests, 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, and finally,
they design the final layout of the database for programmers to code its logic.
• 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 (view level of the database).
• Naive users don't need to be aware of the presence of the database system as they can interact with the
database with the help of menu-driven application interface.
• In simple terms, Naive / Parametric End users work directly on developed applications to access the database
indirectly for getting the desired results.
4. System Analyst :
• 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.
• Sometimes, they are also responsible for the design, structure & functioning of the database.
• If needed, they can change or update the final layout of the database as per requirements.
• System Analysts always make sure that the final product should meet all the requirements.
• 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.) or the user interface so
that other users can use these applications to interact with the database.
• 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.
• When needed, Application Programmers also specify the modifications needed in the database structure for an
application.
• They are efficient enough in designing or developing their database in any language they know.
6. 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.
• Sophisticated users can develop or access their database applications according to the requirements, without
actually writing the program code for it.
• These users are also known as SQL programmers as they can interact with the database directly using SQL
queries using 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.
• 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.
Lecture 5:
Instance and schema in DBMS
DBMS Schema
Schema” and “Instance” are key ideas in a database management system (DBMS) that help organize and manage data.
• Definition of schema:
• The basic structure of how the data will be stored in the database is called schema.
• For example: An employee table in database exists with the following attributes:
• Schema helps the database users to understand the relationship between data.
• This helps in efficiently performing operations on database such as insert, update, delete, search etc.
• In the following diagram, we have a schema that shows the relationship between three tables: Course, Student
and Section.
• The diagram only shows the design of the database, it doesn’t show the data present in those tables.
• Schema is of three types: Physical schema, logical schema and view schema.
• Schema represents the logical view of the database. It helps you understand what data needs to go where.
• The design of a database at physical level is called physical schema, how the data stored in blocks of storage is
described at this level.
• Design of database at logical level is called logical schema, programmers and database administrators work at
this level, at this level data can be described as certain types of data records gets stored in data structures,
however the internal details such as implementation of data structure is hidden at this level (available at
physical level).
• Design of database at view level is called view schema. This generally describes end user interaction with
database systems.
Schema is of three types: Logical Schema, Physical Schema and view Schema.
• In DBMS, the data is stored for a particular amount of time and is called an instance of the database.
• The value of the particular attribute at a particular moment in time is known as an instance of the DBMS.
• Let's take another example: Let's say we have a single table student in the database; today, the table has 100
records, so today, the instance of the database has 100 records. We are going to add another 100 records to this
table by tomorrow, so the instance of the database tomorrow will have 200 records in the table.
• In short, at a particular moment, the data stored in the database is called the instance; this change over time as
and when we add, delete or update data in the database.
1. External level
It is also called view level. The reason this level is called “view” is because several users can view their desired data
from this level which is internally fetched from database with the help of conceptual and internal level mapping.
The user doesn’t need to know the database schema details such as data structure, table definition etc. user is only
concerned about data which is what returned back to the view level after it has been fetched from database (present at
the internal level).
External level is the “top level” of the Three Level DBMS Architecture.
2. Conceptual level
It is also called logical level. The whole design of the database such as relationship among data, schema of data etc.
are described in this level.
Database constraints and security are also implemented in this level of architecture. This level is maintained by DBA
(database administrator).
3. Internal level
This level is also known as physical level. This level describes how the data is actually stored in the storage devices.
This level is also responsible for allocating space to the data. This is the lowest level of the architecture.
Let us understand this with an example, if you go to a shop to buy a pair of shoes, you ask the shopkeeper to show you
the shoes of a certain company, and you also tell the shopkeeper about the size, color, and material you want.
Then, you will only see the specified things in the shoes, or will you be asking the shopkeeper questions such as,
where are these shoes made?
From where does the material come? What is the cost of the material?
The developers keep away the complex data from the user and remove the complications so that the user can
comfortably access data in the database and can only access the data they want, which is done with the help of data
abstraction.
The main purpose of data abstraction is to hide irrelevant data and provide an abstract view of the data.
With the help of data abstraction, developers hide irrelevant data from the user and provide them the relevant data.
By doing this, users can access the data without any hassle, and the system will also work efficiently.
• The physical or internal layer is the lowest level of data abstraction in the database management system.
• It is the layer that defines how data is actually stored in the database.
• It defines complex data structures in detail, so it is very complex to understand, which is why it is kept hidden
from the end user.
• Example: Let’s say we are storing customer information in a customer table. At physical level these records
can be described as blocks of storage (bytes, gigabytes, terabytes etc.) in memory. These details are often
hidden from the programmers.
• The logical or conceptual level is the intermediate or next level of data abstraction.
• It explains what data is going to be stored in the database and what the relationship is between them.
• Example:: At the logical level these records can be described as fields and attributes along with their data
types, their relationship among each other can be logically implemented.
• The programmers generally work at this level because they are aware of such things about database systems.
• There are different views at this level that define the parts of the overall data of the database.
• This level is for the end-user interaction; at this level, end users can access the data based on their queries.
• Example::
• At view level, user just interact with system with the help of GUI and enter the details at the screen, they are
not aware of how the data is stored and what data is stored; such details are hidden from them.
The ability to modify the schema definition of a DBMS at one level, without affecting the schema definition of the
next higher level is called data independence.
(OR)
Data Independence is a concept in Database Management System that can be used to modify the information without
affecting the result of the external program execution in the system.
Data Independence means the ability of the data to change the schema at one level of the database without having to
change the schema at the next higher level.
Purpose: The purpose of data independence is to enhance the security of the system, save time and reduce costs
needed once the information is changed or altered.
Based on the data abstraction, there are two levels of data independence in DBMS:
• Physical Data Independence can be defined as the ability to change the physical level without affecting the
logical or Conceptual level.
• Physical data independence gives us the freedom to modify the - Storage device, File structure, location of the
database, etc. without changing the definition of conceptual or view level.
• Example: For example, if we take the database of the banking system and we want to scale up the database by
changing the storage size and also want to change the file structure, we can do it without affecting any
functionality of logical schema.
Below changes can be done at the physical layer without affecting the conceptual layer -
Logical Data Independence is a property of a database that can be used to change the logic behind the logical level
without affecting the other layers of the database.
Logical data independence is usually required for changing the conceptual schema without having to change the
external schema or application programs.
It allows us to make changes in a conceptual structure like adding, modifying, or deleting an attribute in the database.
Example: If there is a database of a banking system and we want to add the details of a new customer or we want to
update or delete the data of a customer at the logical level data will be changed but it will not affect the Physical level
or structure of the database.
These changes can be done at a logical level without affecting the application program or external layer.
Database Design can be defined as a set of procedures or collection of tasks involving various steps taken to
implement a database.
+-
Following are some critical points to keep in mind to achieve a good database design:
Low Redundancy
Data should be stored in fragmented bits of information in the most atomic format possible.
Requirement Analysis
First of all, the planning has to be done on what are the basic requirements of the project under which the design of the
database has to be taken forward. Thus, they can be defined as:-
Planning
This stage is concerned with planning the entire DDLC (Database Development Life Cycle). The strategic
considerations are taken into account before proceeding.
System definition - This stage covers the boundaries and scopes of the proper database after planning.
Database Designing
The next step involves designing the database considering the user-based requirements and splitting them out into
various models so that load or heavy dependencies on a single aspect are not imposed.
Physical Model - The physical model is concerned with the practices and implementations of the logical model.
Logical Model - This stage is primarily concerned with developing a model based on the proposed requirements.
Implementation
The last step covers the implementation methods and checking out the behavior that matches our requirements.
This section is used to import and convert data from the old to the new system.
Testing - This stage is concerned with error identification in the newly implemented system.
Testing is a crucial step because it checks the database directly and compares the requirement specifications.
Database Design Process
The process of designing a database carries various conceptual approaches that are needed to be kept in mind.
7. Keywords
❖ DBMS
❖ DataAbstraction
❖ Instance
❖ DBA
❖ DataModels
8. SampleQuestions
Remember:
1. DefineDBMS.
2. List 5 differences between database systems and filesystems
3. Define data abstraction
4. What is Data Independence
5. What are the advantages of DBMS
Understand:
1. ExplainDatabaseManagementSystems.
2. Identify various applications of Database Management systems?
3. Compare database systems and file systems
4. Identify the major difference between data base systems and file systems
5. Describe structure of DBMS
6. Illustrate different levels of abstraction
9. StimulatingQuestion(s)
1. How databases can be used in the real world applications.
2. How data base and file system will be distinguished?
11. StudentSummary
13. ScopeforMiniProject
All these basics are highly required to interact with the DBMS
---------------