Sunteți pe pagina 1din 8

RDB College of Arts and Science Introduction to Oracle and SQL

UNIT-I: Introduction to File – Flat File – Advantage and disadvantage of Flat File – Introduction to Database - Types
of database structure: Hierarchical Data Base – Relational Data Base – Object Relational Data Base.
DATABASE MANAGEMENT SYSTEM (DBMS) ACID Properties:
A database management system is a collection of DBMS follows the concepts of Atomicity,
interrelated data and a set of programs to access those Consistency, Isolation, and Durability (ACID).
data. Collection of data is referred to as a database. These concepts are applied on transactions, which
A database is a collection of data elements stored in a manipulate data in a database.
computer in such a systematic way that a computer ACID help the database stay healthy in multi-
program can consult it to answer questions. transactional environments and in case of failure.
A Database Management System (DBMS) is a software Multiuser and Concurrent Access:
package to facilitate the creation and maintenance of a DBMS supports multi-user environment and allows
computerized database. to access & manipulate data in parallel.
Though there are restrictions on transactions when
DBMS CHARACTERISTICS
users attempt to handle the same data item, but
Real-world entity:
users are always unaware of them.
A modern DBMS is more realistic and uses real-
world entities to design its architecture. Multiple views:
DBMS offers multiple views for different users.
Relation-based tables:
A user who is in the Sales department will have a
DBMS allows entities and relations to form tables.
different view of database than a person working in
Users understand the database architecture in the
the Production department.
table names.
This feature enables the users to have a
Isolation of data and application:
concentrate view of the database according to
Database system is entirely different from data.
their requirements.
A database is an active entity, whereas data is
passive entity, on which the database works and Security:
Features like multiple views offer security to some
organizes.
extent where users are unable to access data of
DBMS stores metadata (data about data), to ease
other users and departments.
its own process.
DBMS offers constraints while entering and
Less redundancy:
retrieving the data from database.
DBMS follows the rules of normalization, which
DBMS offers many different levels of security
splits a relation when its attributes is having
features, which enables multiple users to have
redundancy in values.
different views with different features.
Normalization is a mathematically rich and
scientific process that reduces data redundancy. File Systems Versus Database Systems
Consistency: − DBMS are expensive to create in terms of software,
Consistency is a state where every relation in a hardware, and time invested.
database remains consistent. − If we just keep all data in files, then we use word-
There exist methods and techniques, which leaving processors to edit the files (insert, delete, or update
database in inconsistent state. data).
A DBMS can provide greater consistency as − As well as we write our own programs to query the
compared to file-processing systems. data. This solution is called maintaining data in flat
Query Language: files.
DBMS is equipped with query language, which − However, flat files have the following limitations.
makes it more efficient to retrieve and manipulate • Uncontrolled redundancy • Inconsistent data
data. • Inflexibility • Limited data sharing
A user can apply as many and as different • Poor enforcement of standards
filtering options as required to retrieve a set of • Low programmer productivity
data. • Excessive program maintenance
Traditionally it was not possible where file- • Excessive data maintenance
processing system was used.
Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 1
RDB College of Arts and Science Introduction to Oracle and SQL
ADVANTAGE AND DISADVANTAGES OF 5. Integrity Problems:
FLAT-FILE SYSTEM • Data integrity means that the data contained
Advantage of File-oriented system: in the database in both correct and consistent.
1. Backup: For this purpose the data stored in database
• It is possible to take faster and automatic back- must satisfy correct and constraints.
up of data stored in files of computer-based 6. Atomicity Problems:
systems. • Any operation on database must be atomic.
• Computer systems provide back-up • This means, it must happen in its entirely or
functionalities. It is also possible to develop not at all.
specific application program for back-up. 7. Concurrent Access Anomalies:
2. Compactness: • Multiple users are allowed to access data
• It is possible to store data compactly.
simultaneously.this is for the sake of better
3. Data Retrieval:
performance and faster response.
• Computer-based systems provide enhanced
8. Security Problems:
data retrieval techniques to retrieve data stored
• Database should be accessible to users in
in files in easy and efficient way.
limited way.
4. Editing:
• Each user should be allowed to access data
• It is easy to edit any information stored in
computers in form of files. concerning his requirements only.
• Specific application programs or editing Database Users
software can be used for this purpose.
5. Remote Access: Users are differentiated by the way they expect to
• In computer-based systems, it is possible to interact with the system
access data remotely. Application programmers: They interact with system
• so, to access data for a user who not present at through DML calls
location where these data are kept. Sophisticated users: They form requests in a
6. Sharing: database query language
• Data stored in files of computer-based systems Specialized users: They write specialized database
can be shared among multiple users at a same applications that do not fit into the traditional data
time. processing framework
Disadvantage of File-oriented system: Naïve users: They invoke one of the permanent
1. Data Redundancy: application programs that have been written
• It is possible that the same information may be previously E.g. people accessing database over the
duplicated in different files.this leads to data web, bank tellers, clerical staff
redundancy results in memory wastage. Database Administrator
2. Data Inconsistency: Database Administrator Coordinates all the activities
• Because of data redundancy,it is possible that of the database system; he has a good understanding
data may not be in consistent state. of the enterprise’s information resources and needs.
3. Difficulty in Accessing Data:
Database administrator’s duties include:
• Accessing data is not convenient and efficient
a. Schema definition
in file processing system.
b. Storage structure and access method definition
4. Limited Data Sharing:
c. Schema and physical organization modification
• Data are scattered in various files. Also the
d. Granting user authority to access the database
different files may have different formats and
may be stored in different folders of different
e. Specifying integrity constraints
departments. f. Acting as relationship with users
• So, due to this data isolation, it is difficult to
share data among different applications.

Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 2


RDB College of Arts and Science Introduction to Oracle and SQL
DATA: − While the DBMS does not guarantee data quality, it
Data is a collection of facts, figures and statistics provides a framework to facilitate data quality
related to an object. initiatives.
For example: Students fill an admission form when they 7. Increased end-user productivity:
get admission in college. The form consists of raw facts − The DBMS tools transform data into usable
about the students. These raw facts are student's name, information, so the end users make quick decisions
father name, address etc. for success and failure in global economy.
INFORMATION: 8. Controlling Data Redundancy:
Processed data is called information. OR The − In DBMS, all the data of an organization is
manipulated and processed form of data is called integrated into a single database.
information.
− The data is recorded at only one place in the
For example: Data collected from census is used to database and it is not duplicated.
generate different type of information. The government
− In DBMS, the data redundancy can be controlled or
can use it to determine the literacy rate in the country.
reduced but is not removed completely.
Advantages of DBMS
− Sometimes, it is necessary to create duplicate
1. Improved data sharing:
copies of the same data items in order to relate
− The DBMS creates an environment in which end
tables with each other.
users access more and better-managed data.
− By controlling the data redundancy can save
− Such access makes the end users got responses
storage space. Similarly, it is useful for retrieving
quickly in their environment.
data from database using queries.
2. Improved data security:
8. Backup and Recovery Procedures:
− The more users access the data, the greater risk of
− The manual regular backup of data to protect the
data security arises.
valuable data from failures is time consuming.
− A DBMS provides a framework for better
− DBMS provide the 'backup and recovery' sub-
enforcement of data privacy and security policies.
systems that automatically create the backup of
3. Data integration:
data and restore data if required.
− Wider access of well-managed data promotes an
Disadvantages of DBMS
integrated view of the organization’s operations.
1. Increased costs:
− It helps to see how actions in one segment of the
− Database systems require sophisticated hardware,
company affect other segments.
software and highly skilled person.
4. Minimized data inconsistency:
− The cost of maintaining the hardware, software,
− Data inconsistency exists when different versions
and person can be extensive.
of the same data appear in different places.
− Training, licensing, and regulation compliance
− The probability of data inconsistency is greatly
costs are often cared when database systems are
reduced in a properly designed database.
implemented.
5. Improved data access:
2. Management complexity:
− The DBMS makes it possible to produce quick
− Database systems interface with many different
answers to ad hoc queries. technologies impact on a company’s resources
− A query is a specific request to the DBMS for data and culture significantly.
manipulation (to read or update the data). − The changes of database system must be
− The DBMS sends back an answer (called the result properly managed to ensure the company’s
set) to the application query. objectives.
6. Improved decision making: − Database systems are accessed from multiple
− Better-managed data and improved data access sources, so security issues must be assessed
quality, which are used for better decisions. constantly.
− Data quality is a comprehensive approach to
promoting the accuracy, validity, and timeliness of
the data.
Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 3
RDB College of Arts and Science Introduction to Oracle and SQL
3. Maintaining currency: 2.Record Based Logical Models:
− To maximize the efficiency of the database − These models can also be used in describing the
system, we must perform frequent updates and data at the logical and view levels.
security measures. − These models can be used for both to specify the
− Rapid personnel training costs tend to be overall logical structure of the database and a
significant. higher-level description.
4. Frequent upgrade/replacement cycles: − These models can be classified into,
− DBMS vendors frequently upgrade their 1. Relational model.
products by adding new functionality. 2. Network model.
− New software upgrade versions require hardware 3. Hierarchal model.
upgrades. 3. Physical Models:
− It also costs money to train database users and − These models can be used in describing the data at
administrators to properly use and manage the the lowest level, i.e. physical level.
new features. − These models can be classified into
5. Appointing Technical Staff: 1. Unifying model
− The trained technical persons such as database 2. Frame memory model.
administrator and application programmers etc Drawbacks of file systems
are required to handle the DBMS. − Data redundancy and inconsistency
− We have to pay handsome salaries to these − Due to availability of multiple file formats,
storage in files may cause duplication of
persons. Therefore, the system cost increases.
information in different files.
Data Independence − Difficulty in accessing data
Data independence means that any part of data is not
− In order to retrieve, access and use stored data,
dependent on any other part of the data in the DBMS. we need to write a new program to carry out-
They are no way dependent upon their physical storage each new task
and logical arrangements. − Data isolation
Logical data independence changes the − To isolate data we need to store them in multiple
conceptual schema without changing the external files and different Formats.
schemas. − Integrity problems
Physical data independence changes the internal − Integrity constraints (e.g. account balance > 0)
schema without changing the conceptual schema. become part of program code which has to be
DATA MODELS /DATABASE STRUCTURE written every time. It is hard to add new
constraints or to change existing ones.
Data models are a collection of conceptual tools for
describing data, data relationships, data semantics and
− Atomicity of updates
data constraints. There are three different groups:
− Failures of files may leave database in an
inconsistent state with partial updates carried out
1. Object-based Logical Models.
E.g. transfer of funds from one account to
2. Record-based Logical Models.
another should happen either completely or
3. Physical Data Models
Partially.
1.Object Based Logical Models: − Concurrent access by multiple users
− These models can be used in describing the data at − Concurrent access of files is needed for better
the logical and view levels. performance and it is also true that Uncontrolled
− These models are having flexible structuring concurrent accesses of files can lead to
capabilities classified into following types. inconsistencies
E.g. two people reading a balance and updating
a) The entity-relationship model.
it at the same time
b) The object-oriented model.
− Several Security related problems caused in file
c) The semantic data model. system.
d) The functional data model.

Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 4


RDB College of Arts and Science Introduction to Oracle and SQL
DATABASE STRUCTURES
The relationships among the many individual records in databases are based on one of several logical
data structures or models.
DBMS are designed to provide end users with quick, easy access to information stored in databases.
Five fundamental database structures are:
Hierarchical Structure:
Early mainframe DBMS packages used the hierarchical structure, in which:
− Relationships between records form a hierarchy or tree like structure.
− Records are dependent and arranged in multilevel structures, consisting of one root record and any
number of subordinate levels.
− Relationships among the records are one-to-many, since each data element is related only to one
element above it.
− Data element or record at the highest level of the hierarchy is called the root element.
− Any data element can be accessed by moving progressively downward from the root and along the
branches of the tree until the desired record is located.
− Advantages
Ease with which data can be stored and retrieved in structured, routine types of transactions.
Ease with which data can be extracted for reporting purposes.
Structured and routine types of transaction processing is fast and efficiently.
− Disadvantages
Hierarchical one-to many relationships must be specified in advance, and are not flexible.
Cannot easily handle ad hoc requests for information.
Modifying a hierarchical database structure is complex. Great deal of redundancy.
Requires knowledge of a programming language.
Network Structure:
− Can represent more complex logical relationships, and is still used by many mainframe DBMS
packages.
− Allows many-to-many relationships among records.
− That is, the network model can access a data element by following one of several paths, because any
data element or record can be related to any number of other data elements.
− Advantages
More flexible that the hierarchical model.
Ability to provide sophisticated logical relationships among the records.
− Disadvantages
Network many-to-many relationships must be specified in advance.
User is limited to retrieving data that can be accessed using the established links between
records.
Cannot easily handle ad hoc requests for information. Requires knowledge of a programming
language.
Relational Structure:
− Most popular database structure.
− Used by most microcomputer DBMS packages, many minicomputer and mainframe systems.
− Data elements within the database are stored in the form of simple tables.
− Tables are related if they contain common fields.
− DBMS packages based on the relational model can link data elements from various tables to provide
information to users.
Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 5
RDB College of Arts and Science Introduction to Oracle and SQL
− Advantages
Flexible in that is can handle ad hoc information requests.
Easy for programmers to work with.
End users can use this model with little effort or training.
Easier to maintain than the hierarchical and network models.
− Disadvantages
Cannot process large amounts of business transactions as quickly and efficiently as the
hierarchical and network models.
Multidimensional Structure:
− It is a variation of the relational model that uses multidimensional structures to store data and
relationships between data.
− A major benefit of multidimensional databases is that they are a compact and easy-to-understand
way to visualize and manipulate data elements that have many interrelationships.
− Multidimensional databases have become the most popular database structure for the analytical
databases that support online analytical processing (OLAP) applications.
− Advantages
Compact and easy to understand way to visualize and manipulate data elements that have
many interrelationships.
Support OLAP applications in which fast answers to complex business queries are required.
− Disadvantages
Not currently developed for broad business application use.
Object-Oriented Structure
− It is considered to be one of the key technologies of a new generation of multimedia web-based
applications.
− In an object-oriented structure, an object consists of data values describing the attributes of an
entity plus the operations that can be performed upon the data.
− This encapsulation capability allows the object-oriented model to better handle more complex
types of data (graphics, voice, text) than other database structures.
− Supports inheritance, that is, new objects can be automatically created by replicating some or all
of the characteristics of one or more parent objects.
− Object-capabilities and inheritance have made object-oriented database management systems
(OODMS) popular in computer-aided design (CAD) applications.
− Designers can develop product designs, store them as objects in an object-oriented database, and
replicate and modify them to create new product designs.
− Multimedia web-based applications for the Internet and corporate intranets and extranets have
become a major application area for object technology.
− Advantages
Handles complex types of data (graphics, pictures, voice, and text) better than other
structures.
Relatively easy to use.
Key technology being used in multimedia web-based applications for the Internet and
corporate intranets and extranets.
Supports inheritance - new objects can be automatically created by replicating some or all of
the characteristics of one or more parent objects.
− Disadvantages
Not currently developed for broad business use.
Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 6
RDB College of Arts and Science Introduction to Oracle and SQL
Hierarchical Data Model Hierarchical Databases (DBMS) :
The hierarchical data model, each record in the ♣ In the Hierarchical Database Model we have to
database represented a specific parent/child learn about the databases.
relationship. ♣ It is very fast and simple. In a hierarchical
Retrieving the data in a hierarchical database done database, records contain information about there
by navigating the records, moving up, down, and groups of parent/child relationships, just like as a
sideways one record at a time. tree structure.
One of the most popular hierarchical database ♣ The structure implies that a record can have also a
management systems was IBM's Information repeating information.
Management System (IMS), 1968. ♣ In this structure Data follows a series of records,
The advantages of IMS and its hierarchical It is a set of field values attached to it.
model are as follows: ♣ It collects all records together as a record type.
Simple structure: ♣ These record types are the equivalent of tables in
The organization of an IMS database was easy to the relational model, and with the individual
understand. The database hierarchy designed in records being the equivalent of rows.
parallel which represents a company organization ♣ To create links between these record types, the
chart or an organization family tree.
hierarchical model uses these type Relationships.
Parent/child organization:
An IMS database was excellent for representing
parent/child relationships, such as "A is a part of B"
or "A is owned by B."
Performance:
IMS stored parent/child relationships using physical
pointers, so the movement on the database was rapid.
IMS could place parent and child records close to
one another on the disk, minimizing disk
input/output.
IMS is widely used on IBM mainframes DBMS.
It performs high-volume transaction applications
such as processing bank ATM, verifying credit
card, and tracking the delivery.
The hierarchical database became critical when Advantage:
the data became more complex structure. Hierarchical database can be accessed and
This model is Similar to the network model and updated rapidly because in this model structure is
the concepts are derived from the Information like as a tree and the relationships between
Management System and System-200. records are defined in advance. This feature is a
Organization of the records is as a collection of two-edged.
trees, rather than arbitrary graphs. Disadvantage:
Schema represented by a Hierarchical Diagram. This type of database structure is that each child
One record type, called Root, does not participate in the tree may have only one parent, and
as a child record type. relationships or linkages between children are
Every record type except the root participates as not permitted, even if they make sense from a
a child record type in exactly one type. logical standpoint.
Leaf is a record that does not participate in any Hierarchical databases are so in their design. it can
record types. adding a new field or record requires that the entire
A record act as a Parent for number of records. database be redefined.

Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 7


RDB College of Arts and Science Introduction to Oracle and SQL
RELATIONAL DATABASE KEYS:
The relational database uses a collection of A key is an attribute of a table which helps to identify
tables to represent both data and the a row. There can be many different types of keys:
relationships. Each table has multiple columns, Super Key or Candidate Key:
and each column has a unique name. − It is such an attribute of a table that can
The data is arranged in a relation which is visually uniquely identify a row in a table.
represented in a two dimensional table. − Generally they contain unique values and can
The data is inserted into the table in the form of never contain NULL values.
tuples (which are nothing but rows). − There can be more than one super key or
A tuple is formed by one or more than one candidate key in a table.
attributes, which are used as basic building − Example within a STUDENT table Roll and
blocks in the formation of various expressions Mobile No can both serve to uniquely identify a
that are used to derive a meaningful information. student.
There can be any number of tuples in the table, but Primary Key:
all the tuple contain fixed and same attributes − It is one of the candidate keys that are
with varying values.
chosen to be the identifying key for the entire
The relational model is implemented in database
table.
where a relation is represented by a table, a tuple is
− Example although there are two candidate keys in
represented by a row, an attribute is represented by
a column of the table, attribute name is the name of
the STUDENT table, the college would obviously
the column such as ‘identifier’, ‘name’, ‘city’ use Roll as the primary key of the table.
etc., attribute value contains the value for Alternate Key:
column in the row. − This is the candidate key which is not chosen as
Constraints are applied to the table and form the the primary key of the table.
logical schema. − They are named so because although not the
In order to facilitate the selection of a particular primary key, they can still identify a row.
row/tuple from the table, the attributes i.e. column Composite Key:
names are used. − Sometimes one key is not enough to uniquely
All the relational algebra operations, such as Select, identify a row.
Intersection, Product, Union, Difference, Project, − Example in a single class Roll is enough to find a
Join, Division, Merge etc. can also be performed on student but in the entire school merely searching
the Relational Database Model. by the Roll is not enough because there could be
Operations on the Relational Database Model are
10 classes in the school and each one of
facilitated with the help of different conditional
them may contain a certain roll no 5.
expressions, various key attributes, pre-defined
− To uniquely identify the student we have to
constraints etc.
say something like “class VII, roll no 5”.
In the relational databases are more reliable than
either the hierarchical or network database − So a combination of two or more attributes is
structures. combined to create a unique combination of
Properties of Relational Tables: values such as Class + Roll.
Based on the set theory Foreign Key:
No ordering among attributes and tuples − Sometimes we may have to work with an attribute
No duplicate tuples allowed that does not have a primary key of its own.
Value-oriented − To identify its rows, we have to use the
All attribute values are atomic primary attribute of a related table.
No repeating groups − Such a copy of another related table’s primary key
is called foreign key.

Dr. K.T.Senthilkumar M.C.A., M.Phil., M.Sc.-VES., Ph.D., 8

S-ar putea să vă placă și