You are on page 1of 4

UNIT I

LESSON 1:
INTRODUCTION TO DBMS

Review of DBMS-I addition, it may lead to data inconsistency; that is, the

ORACLE DATABASE ADMINISTRATION


This lesson provides an insight into various copies of the same data may no longer agree. For
• Introduction to DBMS example, a changed customer address may be reflected in
saving-account records but not elsewhere in the system.
• Database system vs. File System
• Difficulty in accessing data. Suppose that one bank
• Relational Model
officer needs the data of particular customers who stays in
• Properties of Relational Tables same postal code area. Because the designer of the original
• Relationships and Keys application doesn’t anticipate this request, there is no
Introduction application program on hand to meet it. There is however,
A database is a collection of data, contains information relevant an application program to generate the list of all customers.
to a enterprise for effective decision making. The primary aim of The bank officer now has two choices either obtain the list
the database is to provide a way to store and retrieve database of all customers and extract the need information manually
information that is both convenient an efficient. Data base or ask the system programmer to write the necessary
system is used to maintain large bodies of information. application program. Both this alternative are unsatisfactory
Management of data involves both defining structures for as now if the officer needs the information of the
storage of information and provides mechanism for customers whose balance is more the 10,000. As expected
manipulating the data for various processes in addition such applications are not there to generate the list so officer
database must ensure safety of information despite system has the previous option to apply which is not satisfactory.
crash or unauthorized access. If the data is to share between The point here is that conventional File-processing
several users it must avoid possible anomalous result. environments do not allow needed data to be retrieved in a
Convenient and efficient manner.
Database system vs Files system
• Data isolation. Because data are scattered in various files,
To understand this let us consider a part of the saving-bank
and files may be in different formats, writing new
enterprise that keeps information about all customers and
appropriate program to retrieve the appropriate data is
saving accounts. One way to keep the information on a
difficult.
computer is to store it in operating system files. To allow user
to manipulate the information the system has number of • Integrity problem. The data values stored in the database
application programs that manipulate the files, these are must satisfy certain type of consistency constraints. For
example, the balance of bank accounts may never fall
• A program to debit or credit an account
below a prescribed amount (25). Developers enforce these
• A program to add a new account constraints in the system by adding appropriate code in the
• A program to find the balance of an account various application programs. However, when new
• A program to generate monthly statements constraints are added, it is difficult to change the problem to
enforce them. The problem is compounded when
New applications are added to the system as the need arises.
constraints involve several data items from different files.
This typical file system is supported by various operating
systems. The system store permanent records in various files, • Atomicity problems. A computer system, like any other
and need different application program to extract record from, mechanical or electrical device, is subject to failure. In many
and record to, the appropriate files .Before database manage- application, it is crucial that if failure occurs, the data to be
ment system came along, organization usually stored the restored to the consistent state that existed prior to the
information in such system. failure. Consider a program of transfer 50 from account A
to B. If the failure occurs during the execution of program,
Keeping organizational information in a file –processing
It is possible that the amount may be removed from
system has a number of major disadvantages:
account but not credited to account b, result in a
• Data redundancy and inconsistency. Since different inconsistent database state. Clearly, it is essential to database
programmer creates the files and application programs over consistency that either both the credit occurs, or that neither
a long period, the various files are likely to have different occurs. That is , the funds transfer must be atomic- it must
formats and may be written in different programming happen entirely or not at all . It is difficult to ensure
languages. Moreover, the same information may be atomicity in a conventional file-processing system.
duplicated in several files for example, particular customer
• Concurrent-access anomalies. For the sake of overall
name and address appear in the file saving accounts records
performance of the system and faster response, many
and in a file that consists of checking- account records. The
systems provide multiple users to update the data
redundancy leads to higher storage and access cost. In
simultaneously. In such an environment interaction of the

© Copy Right: Rai University


3E.672/3B.581 1
concurrent updates may result in inconsistent data. Data Structure and Terminology
ORACLE DATABASE ADMINISTRATION

Consider a bank account A, containing amount 500. If two In the relational model, a database is a collection of relational
customers withdraw funds (say 50 and 100 respectively) tables. A relational table is a flat file composed of a set of
from the account at the same time, the result of the named columns and an arbitrary number of unnamed rows.
concurrent execution may leave the account in an incorrect The columns of the tables contain information about the table.
state. Suppose that the programs executing on behalf of The rows of the table represent occurrences of the “thing”
each withdrawal read the old balance, reduce the value by an represented by the table. A data value is stored in the
amount being withdrawn, and write the result back. If the intersection of a row and column. Each named column has a
two programs run concurrently, they may both read the domain, which is the set of values that may appear in that
value 500, and write back 450 and 400, respectively. column. Figure 1 shows the relational tables for a simple
Depending on which one writes the value last, the account bibliographic database that stores information about book title,
may contain either450 and 400, rather the correct value of authors, and publishers.
350. To guard against such possibilities system must
provide supervision. But supervision is difficult to provide
because data may be accessed by many different application
programs that have not been coordinated previously.
• Security problem. Not every user of the database system
should be able to access all the data. For example, in a
banking system, payroll personal need to see only that part
of the database that has information about the various
bank employees. They do not need access to information
about customer accounts. But since application programs
are added to the system in an ad hoc manner, enforcing
such security constraints in difficult.
These difficulties, among others, prompted the development
of database systems. In what follows, we shall see the concepts
and algorithms that enable database system to solve the file
processing systems.
Relational Model
The relational model was formally introduced by Dr. E. F. Cod-
in 1970 and has evolved since then, through a series of writings.
The model provides a simple, yet rigorously defined, concept of
how users perceive data. The relational model represents data in
the form of two-dimension tables. Each table represents some
real-world person, place, thing, or event about which
information is collected. A relational database is a collection of
two-dimensional tables. The organization of data into
relational tables is known as the logical view of the database.
That is, the form in which a relational database presents data to
the user and the programmer. The way the database software
physically stores the data on a computer disk system is called the
internal view. The internal view differs from product to product
and does not concern us here.
A basic understanding of the relational model is necessary to Figure 1
effectively use relational database software such as Oracle,
There are alternate names used to describe relational tables.
Microsoft SQL Server, or even personal database systems such
Some manuals use the terms tables, fields, and records to
as Access or Fox, which are based on the relational model.
describe relational tables, columns, and rows, respectively. The
This section discusses the basic concepts— these are . formal literature tends to use the mathematical terms, relations,
• Data Structure and Terminology attributes, and tuples. Figure 2 summarizes these naming
• Notation conventions.
• Properties of Relational Tables Figure 2: Terminology
• Relationships and Keys
In This Document Formal Terms Many Database Manuals
• Data Integrity
Relational Table Relation Table
Column Attribute Field
Row Tuple Record

© Copy Right: Rai University


2 3E.672/3B.581
Notation The Sequence of Rows is Insignificant

ORACLE DATABASE ADMINISTRATION


Relational tables can be expressed concisely by eliminating the This property is analogous the one above but applies to rows
sample data and showing just the table name and the column instead of columns. The main benefit is that the rows of a
names. For example, relational table can be retrieved in different order and sequences.
AUTHOR (au_id, au_lname, au_fname, address, city, state, zip)
Adding information to a relational table is simplified and does
TITLE (title_id, title, type, price, pub_id) not affect existing queries.
PUBLISHER (pub_id, pub_name, city)
AUTHOR_TITLE (au_id, title_id) Each Column Has a Unique Name
Because the sequence of columns is insignificant, columns must be referenced by
Properties of Relational Tables name and not by position. In general, a column name need not be unique within
Relational tables have six properties an entire database but only within the table to which it belongs.
1. Values are atomic. Relationships and Keys
2. Column values are of the same kind. A relationship is an association between two or more tables.
Relationships are expressed in the data values of the primary
3. Each row is unique.
and foreign keys.
4. The sequence of columns is insignificant. A primary key is a column or columns in a table whose values
5. The sequence of rows is insignificant. uniquely identify each row in a table. A foreign key is a column
6. Each column must have a unique name. or columns whose values are the same as the primary key of
another table. You can think of a foreign key as a copy of
Values Are Atomic
primary key from another relational table. The relationship is
This property implies that columns in a relational table are not
made between two relational tables by matching the values of
repeating group or arrays. Such tables are referred to as being in
the foreign key in one table with the values of the primary key
the “first normal form” (1NF). The atomic value property of
in another.
relational tables is important because it is one of the
Keys are fundamental to the concept of relational databases
cornerstones of the relational model.
because they enable tables in the database to be related with each
The key benefit of the one value property is that it simplifies other. Navigation around a relational database depends on the
data manipulation logic. ability of the primary key to unambiguously identify specific
Column Values Are of the Same Kind rows of a table. Navigating between tables requires that the
In relational terms this means that all values in a column come foreign key is able to correctly and consistently reference the
from the same domain. A domain is a set of values which a values of the primary keys of a related table. For example, the
column may have. For example, a Monthly_Salary column figure below shows how the keys in the relational tables are
contains only specific monthly salaries. It never contains other used to navigate from AUTHOR to TITLE to PUBLISHER.
information such as comments, status flags, or even weekly AUTHOR_TITLE is an all key table used to link AUTHOR and
salary. TITLE. This relational table is required because AUTHOR and
TITLE have a many-to-many relationship.
This property simplifies data access because developers and
users can be certain of the type of data contained in a given Data Integrity
column. It also simplifies data validation. Because all values are
from the same domain, the domain can be defined and
enforced with the Data Definition Language (DDL) of the
database software.
Each Row is Unique
This property ensures that no two rows in a relational table are
identical; there is at least one column, or set of columns, the
values of which uniquely identify each row in the table. Such
columns are called primary keys and are discussed in more detail
in Relationships and Keys.
This property guarantees that every row in a relational table is
meaningful and that a specific row can be identified by specify-
ing the primary key value.
The Sequence of Columns is Insignificant
This property states that the ordering of the columns in the
relational table has no meaning. Columns can be retrieved in any
order and in various sequences. The benefit of this property is
that it enables many users to share the same table without
concern of how the table is organized. It also permits the
physical structure of the database to change without affecting
the relational tables.

© Copy Right: Rai University


3E.672/3B.581 3
Data integrity means, in part, that you can correctly and consis-
ORACLE DATABASE ADMINISTRATION

tently navigate and manipulate the tables in the database. There


are two basic rules to ensure data integrity; entity integrity and
referential integrity.
The entity integrity rule states that the value of the primary key
can never be a null value (a null value is one that has no value
and is not the same as a blank). Because a primary key is used to
identify a unique row in a relational table, its value must always
be specified and should never be unknown. The integrity rule
requires that insert, update, and delete operations maintain the
uniqueness and existence of all primary keys.
The referential integrity rule states that if a relational table has a
foreign key, then every value of the foreign key must either be
null or match the values in the relational table in which that
foreign key is a primary key.
Notes

© Copy Right: Rai University


4 3E.672/3B.581

You might also like