Professional Documents
Culture Documents
Database Management
System
UNIT 1
Introduction to dbms
Data - unprocessed information
- raw facts/ figures.
Information- Processed Data.
Data is converted into information, and information is
converted into knowledge.
DBMS
Database Management System is a collection
of interrelated data and a set of programs to access those
data.
The examples of DBMS are MS-ACCESS, ORACLE, SQL
SERVER etc.
Database Applications:-
◦ Banking: transactions
◦ Airlines: reservations, schedules
◦ Universities: registration, grades
◦ Sales: customers, products, purchases
◦ Online retailers: order tracking, customized
recommendations
◦ Manufacturing: production, inventory, orders etc.
◦ Human resources: employee records, salaries, tax
deductions
Goals of Database Management
System
In addition, it may lead to data inconsistency, i.e., the various copies of the
same data may no longer agree.
For eg; a changed address may be reflected in savings-account records but
not elsewhere in the system.
2. Difficulty in accessing data
In file processing, to allow users to manipulate the information, the
system has a number of application programs. When we want a
particular set of information with file system, the system programmer
has to write the necessary application program.
Eg: customers name in a particular city.
i.e., File processing environments do not allow needed data to be
retrieved in a convenient and efficient manner.
3. Separation and isolation of data
Since data are scattered in various files, and files may be in different formats,
writing new application programs to retrieve the appropriate data is difficult.
Data Isolation deals with consistency and completeness of data retrieved by
queries unaffecting a user data by other user actions.
4. Integrity problems
The data values stored in the database must satisfy certain types of
consistency constraints.
For eg:, the balance of a bank account may never fall below a prescribed amount.
Developers enforce these constraints in the system by adding appropriate code
in the various application programs. However, when new constraints are
added, it is difficult to change the program to enforce them. The problem is
compounded when constraints involve several data items from different files.
5. Atomicity problems
A computer is subject to failure. In many applications , it is
crucial that, once a failure occurs and has been detected, the data
are restored to the consistent state that existed prior to the
failure. For e.g., consider transferring of money from account A to
B. If a system failure occurs during the execution of a program, it
is possible that the money was removed from account A but was
not credited to account B, resulting in an inconsistent database
state. So the fund transfer must be atomic that means it must
happen in its entirety or not at all.
6. Concurrent access anomalies.
For the sake of overall performance of the system and faster response,
many systems allow multiple users to update the data simultaneously. In
such an environment, interaction of concurrent updates may result in
inconsistent data.
Consider bank account A, containing Rs.5000/-. If two customers
withdraw funds (say Rs.500 & Rs.1000 respectively) from account A at
about the same time, the result of the concurrent executions may leave
the account in an incorrect state. If the two programs run concurrently,
they may both red the value Rs.5000, and write back Rs.4500 and Rs.4000
respectively. Depending on which one writes the vale last, the account may
contain Rs.4500 or Rs.4000, rather than the correct value of Rs.3500. To
guard against this possibility, system must maintain some form of
supervision
7.Security problems.
Not every user of the database system should be able to access all the
data. For example, in a university, payroll personnel need to see only
that part of the database that has financial information. They do not
need access to information about academic records. But, since
application programs are added to the file-processing system in an ad
hoc manner, enforcing such security constraints is difficult.
Benefits of Database Approach
oThe data can be shared.
oRedundancy can be reduced.
oInconsistency can be avoided.
oTransaction support can be provided.
oImproved security.
oImproved data integrity.
oImproved maintenance through data independence.
oIncreased concurrency.
oImproved backup and recovery services.
Basic concepts and
terminologies of database
management system
Criteria – the conditions that control which records to display in a
query.
Database – a collection of information related to a particular topic
or purpose.
There are two types of databases: Nonrelational and relational.
Database management system – a program such as Access,
that stores, retrieves, arranges, and formats information contained
in a database.
Database model – the structure of the information stored in the
database.
This model should included how each individual piece of information
relates to all the other information in the database.
Proper planning, even in the initial pencil-and-paper stage, ensures
that the database you create and maintain is efficient and provides
easy access to the information you need most.
A well-designed database should eliminate the need to enter the
same data repeatedly and prevent duplication of information, thereby
maintaining the integrity of the data.
Database modeling – the process of strategically planning where to
store each piece of information you wish to include in your database.
Field – a specific item of information containing a homogenous set of values
throughout the table. Fields appear as columns in a table and as cells in a
form.
Field data types - a characteristic of a field that determines what kind of data it
can store.
For example, a field whose data type is Text can store data consisting of either text
or number characters, but a Number field can store only numerical
data.
Field list – a small window that lists the fields of a selected table or data source.
Form – a structured document with specific areas for viewing or entering data one
record at a time. Forms can be constructed in columnar, tabular, datasheet, or a
simple justified format.
Primary Key – a field in a table whose value is uniquely identifies
each record in the table.
Query – a request for a particular collection of data in a database
Record – an individual listing of related information consisting of
a number of related fields stored in a table. A record is also called
a row in the datasheet.
Recordset – the set of records and fields that result from running
a query.
Related table – a table with a common field that uses values
stored in a primary table.
Relational database – is useful for maintaining and analyzing
complex information stored in a number of tables.
Relationship – the direct or indirect association between any two
tables in a database.
Select Query – a query that answers a question about one or
more tables by limiting the number of records and fields
displayed.
Table – an arrangement of related information stored in columns
and rows.
Views of Data – The Three- Level
Architecture
•The major purpose of a database system is to provide users with an
abstract view of the data. That is, the system hides certain details of
how the data are stored and maintained.
Data Abstraction
The system hides certain details of how the data are stored and
maintained.
To retrieve data efficiently, complex data structures are used to
represent data in the database. Since many database systems users are
not computer trained, developers hide the complexity from users
through several levels of abstraction to simplify user’s interactions with
the system.
Three tier architecture of data
view
Conceptual level
Internal Level
• 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.
•These sorts of applications are generally called online transaction processing
(OLTP) applications. A fundamental role of multi-user DBMS software is to make
sure that concurrent transactions operate correctly and efficiently with no
inconsistency.
•The concept of a transaction has become central to several database applications. A
transaction is an executing program or process that has one or more database
accesses, like reading or updating of database records or inserting new records.
•The isolation property ensures that every transaction appears to execute in isolation
from other transactions, many transactions could also be executed concurrently
without affecting each other.
•The atomicity property ensures that either all the database operations during a
transaction are executed or none are, these all ACID properties we know.
Database Administrator
One of the main reasons for using DBMSs is to have central
control of both the data and the programs that access those
data. A person who has such central control over the system
is called a database administrator ( DBA).
The functions of a DBA include:
• 1.Schema definition.
The DBA creates the original database schema by executing
a set of data definition statements in the DDL(Data
Definition Language).
•2.Storage structure and access-method definition.
•3.Schema and physical-organization modification.
The DBA carries out changes to the schema and physical organization to
reflect the changing needs of the organization, or to alter the physical
organization to improve performance.
•4.Granting of authorization for data access.
By granting different types of authorization, the database administrator
can regulate which parts of the database various users can access.
The authorization information is kept in a special system structure that
the database system consults whenever someone attempts to access
the data in the system.
•5.Routine maintenance.
Examples of the database administrator’s routine maintenance activities
are:
◦Periodically backing up the database, either onto tapes or onto remote
servers, to prevent loss of data in case of disasters such as flooding.
◦Ensuring that enough free disk space is available for normal
operations,and upgrading disk space as required.
◦Monitoring jobs running on the database and ensuring that
performance is not degraded by very expensive tasks submitted by
some users.
Database Users
There are four different types of database-system users, differentiated
by the way they expect to interact with the system. Different types of
user interfaces have been designed for the different types of users.
1. Naïve Users
2. Application Programmers
3. Sophisticated Users
4. Specialized Users
1.Naive users are unsophisticated users who interact with the system
by invoking one of the application programs that have been written
previously.
For example, a clerk in the university who needs to add a new instructor
to the database
•2.Application programmers are computer professionals who write
application programs. Application programmers can choose from many
tools to develop user interfaces. Rapid application development (RAD)
tools are tools that enable an application programmer to construct forms
and reports with minimal programming effort.
Name Address
Student
Id Age
Components of ER Diagram
Entity Attributes Relation
An entity is a real-world thing which can be distinctly identified like a person,
place or a concept.
Entity Set is a collection or a group of ‘entities’ sharing exactly the ‘same set of
attributes’.
In E-R Diagram, Entity is represented using Rectangles.
3. Multivalued Attribute –
An attribute consisting more than one value for a given entity. For
example, Phone_No (can be more than one for a given student). In ER
diagram, multivalued attribute is represented by double oval.
4. Derived Attribute –
An attribute which can be derived from other attributes of the entity
type is known as derived attribute. e.g.; Age (can be derived from DOB).
In ER diagram, derived attribute is represented by dashed oval.
RELATIONSHIP
An association among entities is called Relationship. A relationship is represented by
diamond shape in ER diagram, it shows the relationship among entities.
Relationships too can have attributes, these attributes are called Descriptive
Attributes.
Relationship Set-
A relationship set is a set of relationships of same type.
Example-
AAAAAAAAAAAA
2.One to Many Relationship
When a single instance of an entity is associated with more than one instances of another entity then
it is called one to many relationship. For example – a customer can place many orders but a order
cannot be placed by many customers.
ADSAFDSDFSF
ADSAFDSDFSF
4. Many to Many Relationship
When more than one instances of an entity is associated with more than
one instances of another entity then it is called many to many relationship.
For example, a can be assigned to many projects and a project can be
assigned to many students.
AADHBHJHJJBJJBHJBHJBHJB
HJFSFGFXFG
E-R Diagram
Geometric shapes and meaning in ER diagram
adfdfsfdgfdgdgfghfhgfhj
DBMS Keys
•Keys play an important role in the relational database.
•It is used to uniquely identify any record or row of data from the table. It is
also used to establish and identify relationships between tables.
For example: In Student table, ID is used as a key because it is unique for
each student. In PERSON table, passport_number, license_number, SSN are
keys since they are unique for each person.
Types of key: