unit1 R20-DBMS
unit1 R20-DBMS
Data:
It is a collection of raw facts.
The facts that can be recorded and which have implicit meaning
known as'data'. Example:
Customer -----
1. cname.
2. cno.
3. ccity.
Database:
It is a collection of interrelated data.
These can be stored in the form of tables.
A database can be of any size and varying complexity.
A database may be generated and manipulated manually or it may be computerized.
Example:
Customer database consist the fields as cname, cno, and ccity
Database System:
It is computerized system, whose overall purpose is to maintain the information and to make
that theInformation is available on demand.
Advantages:
1. Redundancy can be reduced.
2. Inconsistency can be avoided.
3. Data can be shared.
4. Standards can be enforced.
5. Security restrictions can be applied.
6. Integrity can be maintained.
7. Data gathering can be possible.
8. Requirements can be balanced
Advantages of DBMS:
1. Data Independence.
2. Efficient Data Access.
3. Data Integrity and security.
Page 1
4. Data administration.
5. Concurrent access and Crash recovery.
6. Reduced Application Development Time.
Data Sharing
The integration of the whole data in an organization leads to the ability to produce more
information from a given amount of data.
Data Independence
System data (Meta Data) descriptions are separated from the application programs. Changes
to the data structure is handled by the DBMS and not embedded in the program.
Transaction Processing
The DBMS must include concurrency control subsystems to ensure that several users trying
to update the same data do so in a controlled manner. The results of any updates to the
database must maintain consistency and validity.
DBMS is a collection of data. In DBMS, the user is File system is a collection of data. In this system, the
not required to write the procedures. user has to write the procedures for managing the
database.
DBMS gives an abstract view of data that hides the File system provides the detail of the data
details. representation and storage of data.
DBMS provides a crash recovery mechanism, i.e., File system doesn't have a crash mechanism, i.e., if
DBMS protects the user from the system failure. the system crashes while entering some data, then
the content of the file will lost.
DBMS provides a good protection mechanism. It is very difficult to protect a file under the file
system.
DBMS contains a wide variety of sophisticated File system can't efficiently store and retrieve the
techniques to store and retrieve the data. data.
DBMS takes care of Concurrent access of data In the File system, concurrent access has many
using some form of locking. problems like redirecting the file while other deleting
some information or updating some information.
Database Users
Actors on Scene
Actors on the Scene These apply to "large" databases, not "personal" databases that are
defined, constructed, and used by a single person via, say, Microsoft Access. Users may be
divided into Those who actually use and control the database content, and those who design,
develop and maintain database applications (called “Actors on the Scene”), and Those who
design and develop the DBMS software and related tools, and the computer systems
operators (called “Workers behind the Scene”).
1. Database Administrator (DBA): This is the chief administrator, who oversees and
manages the database system (including the data and software). Duties include
authorizinguserstoaccessthedatabase,coordinating/monitoring itsuse,acquiring
hardware/softwarefor upgrades, etc.In largeorganizations, theDBA might haveasupport staff.
2. Database Designers: They are responsible for identifying the data to be stored and for
choosing an appropriate way to organize it. They also define views for different categories of
users. The final design must be able to support the requirements of all the user sub-groups.
3. End Users: These are persons who access the database for querying, updating, and report
generation. They are main reason for database's existence!
Casual end users: use database occasionally, needing different information each time; use
query language to specify their requests; typically middle- or high-level managers.
Naive/Parametric end users: Typically the biggest group of users; frequently query/update
the database using standard canned transactions that have been carefully programmed and
tested in advance. Examples: Bank tellers check account balances, post withdrawals/deposits
Reservation clerks for airlines, hotels, etc., check availability of seats/rooms and make
reservations. Shipping clerks (e.g., at UPS) who use buttons, bar code scanners, etc., to
update status of intransit packages.
Sophisticated end users: engineers, scientists, business analysts who implement their own
applications to meet their complex needs.
Stand-alone users: Use "personal" databases, possibly employing a special purpose (e.g.,
financial) software package. Mostly maintain personal databases using ready-to-use packaged
applications
Tool developers: design and implement software tools facilitating database system Design,
performance monitoring, creation of graphical user interfaces, prototyping, etc.
Operators and maintenance personnel: responsible for the day-to-day operation of the
system.
2. Sharing of Data
In DBMS, data can be shared by authorized users of the organization. The database
administrator manages the data and gives rights to users to access the data. Many users can be
authorized to access the same piece of information simultaneously. The remote users can also
share same data. Similarly, the data of same database can be shared between different
application programs.
3. Data Consistency
By controlling the data redundancy, the data consistency is obtained. If a data item appears
only once, any update to its value has to be performed only once and the updated value is
immediately available to all users. If the DBMS has controlled redundancy, the database
system enforces consistency.
4. Integration of Data
In Database management system, data in database is stored in tables. A single database
contains multiple tables and relationships can be created between tables (or associated data
entities). This makes easy to retrieve and update data.
5. Integration Constraints
Integrity constraints or consistency rules can be applied to database so that the correct data
can be entered into database. The constraints may be applied to data item within a single
record or they may be applied to relationships between records.
6. Data Security
Form is very important object of DBMS. You can create forms very easily and quickly in
DBMS. Once a form is created, it can be used many times and it can be modified very easily.
The created forms are also saved along with database and behave like a software component.
A form provides very easy way (user-friendly) to enter data into database, edit data and
display data from database. The non-technical users can also perform various operations on
database through forms without going into technical details of a database.
7. Report Writers
Most of the DBMSs provide the report writer tools used to create reports. The users can
create very easily and quickly. Once a report is created, it can be used may times and it can
be modified very easily. The created reports are also saved along with database and behave
like a software component.
Database applications
1. Hierarchical Model
This database model organizes data into a tree-like-structure, with a single root, to
which all the other data is linked. The hierarchy starts from the Root data, and
expands like a tree, adding child nodes to the parent nodes.
In this model, a child node will only have a single parent node.
This model efficiently describes many real-world relationships like index of a book,
recipes etc.
In hierarchical model, data is organized into tree-like structure with one-to-many
relationship between two different types of data, for example, one department can
have many courses, many professors and of-course many students.
2. Network Model
This is an extension of the Hierarchical model.
In this model data is organized more like a graph, and are allowed to have more than
one parent node.
In this database model data is more related as more relationships are established in
this database model.
Also, as the data is more related, hence accessing the data is also easier and fast.
This database model was used to map many-to-many data relationships.
This was the most widely used database model, before Relational Model was
introduced.
3. Entity-relationship Model
In this database model, relationships are created by dividing object of interest into
entity and its characteristics into attributes.
Different entities are related using relationships.
E-R Models are defined to represent the relationships into pictorial form to make it
easier for different stakeholders to understand.
This model is good to design a database, which can then be turned into tables in
relational model (explained below).
Let's take an example, if we have to design a School Database, then Student will be
an entity with attributes name, age, address etc. As Address is generally complex, it
can be another entity with attributes street name, pin code, city etc, and there will be
a relationship between them.
Relationships can also be of different types. To learn about E-R Diagrams in details,
click on the link.
4. Relational Model
In this model, data is organized in two-dimensional tables and the relationship is
maintained by storing a common field.
This model was introduced by E.F Codd in 1970, and since then it has been the most
widely used database model, in fact, we can say the only database model used around
the world.
The basic structure of data in the relational model is tables.
All the information related to a particular type is stored in rows of that table.
Hence, tables are also known as relations in relational model.
In the coming tutorials we will learn how to design tables, normalize them to reduce
data redundancy and how to use Structured Query language to access data from
tables.
5. Object-Oriented Data Models
Object oriented data model is one of the developed data model and this can hold the
audio, video and graphic files. These consist of data piece and the methods which are
the DBMS instructions.
6. Object-Relational Models
Most Recent Trend. Started with InformixUniversal Server.
Relational systems incorporate concepts from object databases leading to
objectrelational.
Object relation model is a very powerful model but coming to it’s design it is quiet
complex.
This complexity is not problem because it gives efficient results and widespread with
huge applications.
It has a feature which allows working with other models like working with the very
known relation model.
ConceptsofSchema,Instanceand dataindependence
Database Schema
A database schema is the skeleton structure that represents the logical view of the entire
database. It defines how the data is organized and how the relations among them are
associated. It formulates all the constraints that are to be applied on the data.
A database schema defines its entities and the relationship among them. It contains a
descriptive detail of the database, which can be depicted by means of schema diagrams. It’s
the database designers who design the schema to help programmers understand the database
and make it useful.
Database Instance
It is important that we distinguish these two terms individually. Database schema is the
skeleton of database. It is designed when the database doesn't exist at all. Once the database
is operational, it is very difficult to make any changes to it. A database schema does not
contain any data or information.
A database instance is a state of operational database with data at any given time. It contains
a snapshot of the database. Database instances tend to change with time. A DBMS ensures
that its every instance (state) is in a valid state, by diligently following all the validations,
constraints, and conditions that the database designers have imposed.
If a database system is not multi-layered, then it becomes difficult to make any changes in
the database system. Database systems are designed in multi-layers as we learnt earlier.
Data Independence
A database system normally contains a lot of data in addition to users’ data. For example, it
stores data about data, known as metadata, to locate and retrieve data easily. It is rather
difficult to modify or update a set of metadata once it is stored in the database. But as a
DBMS expands, it needs to change over time to satisfy the requirements of the users. If the
entire data is dependent, it would become a tedious and highly complex job.
Data independence is ability to modify a schema definition in one level without affecting a
schema definition in the next higher level.
CONCEPTUAL LEVEL
The logical structure of the entire database as seen by DBA.
What data is stored in the database
The relationships among the data.
Complete view of the data requirements of the organization, independent of any
storageconsideration.
nts: - ∀ entities, Represe
information on dataattributes, relations information
- security, integrity - constraints on data
Supports each-external view:
semantic
any
data available to auser must be contained in, or derivable from the conceptual level.
INTERNAL LEVEL
Physical representation of the DB on the computer.
How the data is stored in the database.
Physical implementation of the DB to achieve optimal run– time performance and
storage space utilization. - Storage space allocation for data and indexes - Record
description for storage - Record placement - Data compression, encryption
Database System Structure
Applications:-Itcanbeconsideredasauserfriendlywebpagewheretheuserenters
therequests.Herehesimply entersthedetailsthatheneedsandpressesbuttonsto get thedata
End User: - They are the real users of the database. They can be developers, designers,
administrator or the actual users of the database.
DDL: - Data Definition Language (DDL) is a query fired to create database, schema, tables,
mappings etc in the database. These are the commands used to create the objects like tables,
indexes in the database for the first time. In other words, they create structure of the database.
DDL Compiler: - This part of database is responsible for processing the DDL
commands. That means these compiler actually breaks down the command into machine
understandable codes. It is also responsible for storing the metadata information like table
name, space used by it, number of columns in it, mapping information etc.
DML Compiler: - When the user inserts, deletes, updates or retrieves the record from the
database, he will be sending request which he understands by pressing some buttons. But for
the database to work/understand the request, it should be broken down to object code. This is
done by this compiler. One can imagine this as when a person is asked some question, how
this is broken down into waves to reach the brain!
Query Optimizer: - When user fires some request, he is least bothered how it will be fired
on the database. He is not all aware of database or its way of performance. But whatever be
the request, it should be efficient enough to fetch, insert, update or delete the data from the
database. The query optimizer decides the best way to execute the user request which is
received from the DML compiler. It is similar to selecting the best nerve to carry the waves
to brain!
Stored Data Manager: - This is also known as Database Control System. It is one the main
central system of the database. It is responsible for various tasks
It converts the requests received from query optimizer to machine
understandable form. It makes actual request inside the database. It is like fetching
the exact part of the brain to answer.
It helps to maintain consistency and integrity by applying the constraints.
That means, it does not allow inserting / updating / deleting any data if it has child
entry. Similarly it does not allow entering anyduplicate value into database tables.
It controls concurrent access. If there is multiple users accessing the database at the
same time, it makes sure, all of them see correct data. It guarantees that there is no
data loss or data mismatch happens between the transactions of multiple users.
It helps to back up the database and recover data whenever required. Since it is a
hugedatabase and when there is any unexpected exploit of transaction, and reverting the
changes are not easy. It maintains the backup of all data, so that it can be recovered.
Data Files: - It has the real data stored in it. It can be stored as magnetic tapes, magnetic
disks or optical disks.
Compiled DML: - Some of the processed DML statements (insert, update, delete) are stored
in it so that if there is similar requests, it will be re-used.
Data Dictionary: - It contains all the information about the database. As the name suggests,
it is the dictionary of all the data items. It contains description of all the tables, view,
materialized views, constraints, indexes, triggers etc.
1. Hardware: Hardware refers to all of the system's physical devices; for example,
computers storagedevices, printers, network devices and etc.
b) DBMSsoftware:Itmanagesthedatabasewithinthedatabasesystem.Someexamplesof
DBMSsoftwareincludeOracle,Access, MySqland etc.
c) Applicationprograms:These areusedtoaccessandmanipulatedataintheDBMS
and to managethecomputerenvironmentinwhichdataaccessandmanipulationtake place.
Applicationsprogramsaremostcommonlyusedtoaccessdatatogeneratereports. Most
of the application programs provide GUI.
a) Systemadministrators:Theysupervisethe databasesystem'sgeneraloperations.
c) Databasedesigners:Theydesignthedatabasestructure.
TheyarethedatabaseArchitects. As this isverycritical, thedesigner's job responsibilities
areincreased.
d) Systems analysts and programmers: They design and implement the application
programs. Theydesignandcreatethedataentryscreens,reports,andproceduresthroughwhichend
users canaccess and manipulate thedata.
e) End users: They are the people who use the application programs to run the
organization'sdaily operations. For example, sales-clerks, supervisors, managers are
classified as endusers.
4. Procedures: Procedures are the instructions and rules that supervise the design and use of
the databasesystem. Procedures are a critical component of the system. Procedures play an
important role in a company becausethey enforce the standards by which business is
conducted in an organization
5. Data: Data refers the collection of facts stored in the database. Because data are the raw
material from whichinformation is generated, no database can exist without database.
Centralized Architecture of DBMS
This intermediate layer or middle tier is called the application server or the Wbe
server, depending on the application.
This server plays an intermediary role by run-ning application programs and storing
business rules (procedures or constraints) that are used to access data from the
database server.
It can also improve database security by checking a client’s credentials before
forwarding a request to the data-base server.
Clients contain GUI interfaces and some additional application-specific business
rules. The intermediate server accepts requests from the client, processes the request
and sends database queries and commands to the database server, and then acts as a
conduit for passing (partially) processed data from the database server to the clients,
where it may be processed further and filtered to be presented to users in GUI format.
Thus, the user interface, application rules, and data access act as the three tiers.
Basic Client/Server Architectures
There are three types of Client/Server Architectures:
1. Single tier architecture
2. Two tier architecture
3. Three tier architecture
3- tier schema is an extension of the 2-tier architecture. 3-tier architecture has following layers
1. Presentation layer (your PC, Tablet, Mobile, etc.)
2. Application layer (server)
3. Database Server
In three-tier architecture, another layer is present between the clientmachine and server
machine. In this architecture, the client application doesn’t communicate directly with the
database systems present at the server machine, rather the client application communicates
with server application and t he server application internally communicates with the database
system present at the server.