13
UNIT ± I What is a Database? A collection of related pieces of data:Representing/capturing the information about a real-world enterprise or part of an enterprise.Collected and maintained to serve specific data management needs of the enterprise.Activities of the enterprise are supported by the database and continually update the database. Database Systems: A Database Management System (DBMS) is a set of computer programs  that controls the creation, maintenance, and t he use of a database . It a llows organizations to place control of database development in the hands of database administrators (DBAs) and other specialists. A DBMS is a system software package that helps the use of integrated collection of data records and files known as dat abases. It allows different user application programs to easily access the same database. DBMSs may use any of a variety of database models , such as the network model or relational model . In large systems, a DBMS allows users and other software to store and retrieve data in a structured way. Instead of having to write computer programs to extract information, user can ask simple quest ions in a query language . Thus, many DBMS  packages provide Fourth-generation programming language (4GLs) and other application development features. It helps to specify the logical organization for a database and acce ss and use the information within a database. It provides facilities for controlling data access , enforcing data integrity , managing concurrency, and restoring the database from backups. A DBMS also  provides the ability to logically present d atabase information to users. Databases have been in use since the earliest days of electronic computing. Unlike modern systems which can be app lied to widely different databases and needs, the vast majority of older systems were tightly linked to the custom databases in order to gain speed at the expense of flexibili ty. Or iginally DBMSs were found only in large organizations with the computer hardware needed to support large data sets. The Evolution of Database systems y File Management System y Hierarchical database System y Network Database System y R elational Database System y File Management System: The file management system also called as FMS in short is one in which all data is stored on a single large file. The main disadvantage in this system is searching a record or data takes a long time. This lead to the introduction of the concept,of indexing in this system. Then also the FMS system had lot of drawbacks to name a few like updating or modifications to the data cannot be handled easily, sorting the records took long time and so on. All these drawbacks led to the introduction of the Hierarchical Database System.

RDBMS UNIT-I

Embed Size (px)

Citation preview

Page 1: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 1/13

UNIT ± I

What is a Database?

A collection of related pieces of data:Representing/capturing the information about a real-world

enterprise or part of an enterprise.Collected and maintained to serve specific data management

needs of the enterprise.Activities of the enterprise are supported by the database and

continually update the database.

Database Systems: A Database Management System (DBMS) is a set of computer programs 

that controls the creation, maintenance, and the use of a database. It allows organizations to placecontrol of database development in the hands of database administrators (DBAs) and other 

specialists. A DBMS is a system software package that helps the use of integrated collection of data records and files known as databases. It allows different user application programs to easily

access the same database. DBMSs may use any of a variety of database models, such as thenetwork model or relational model. In large systems, a DBMS allows users and other software to

store and retrieve data in a structured way. Instead of having to write computer programs toextract information, user can ask simple questions in a query language. Thus, many DBMS

 packages provide Fourth-generation programming language (4GLs) and other applicationdevelopment features. It helps to specify the logical organization for a database and access and

use the information within a database. It provides facilities for controlling data access, enforcingdata integrity, managing concurrency, and restoring the database from backups. A DBMS also

 provides the ability to logically present database information to users.

Databases have been in use since the earliest days of electronic computing. Unlike modern

systems which can be applied to widely different databases and needs, the vast majority of older systems were tightly linked to the custom databases in order to gain speed at the expense of flexibility. Originally DBMSs were found only in large organizations with the computer  

hardware needed to support large data sets.

The Evolution of Database systems

y  File Management System y  Hierarchical database Systemy  Network Database Systemy  R elational Database System

y  File Management System: The file management system also called as FMSin short is one in which all data is stored on a single large file. The maindisadvantage in this system is searching a record or data takes a long time.This lead to the introduction of the concept,of indexing in this system. Thenalso the FMS system had lot of drawbacks to name a few like updating ormodifications to the data cannot be handled easily, sorting the records tooklong time and so on. All these drawbacks led to the introduction of theHierarchical Database System.

Page 2: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 2/13

y  Hierarchical Database System: The previous system FMS drawback of accessing records and sorting records which took a long time was removed inthis by the introduction of parent-child relationship between records indatabase. The origin of the data is called the root from which severalbranches have data at different levels and the last level is called the leaf. Themain drawback in this was if there is any modification or addition made tothe structure then the whole structure needed alteration which made the taska tedious one. In order to avoid this next system took its origin which iscalled as the Network Database System.

y  Network Database System: In this the main concept of many-manyrelationships got introduced. But this also followed the same technology of pointers to define relationships with a difference in this made in theintroduction if grouping of data items as sets.

y  R elational Database System: In order to overcome all the drawbacks of 

the previous systems the Relational Database System got introduced inwhich data get organized as tables and each record forms a row with manyfields or attributes in it. Relationships between tables are also formed in thissystem.

File-oriented and database approaches contrastedy  There was virtually no integration across application areas. Most business data processing

y  systems developed in the 1970s and the early 1980s employed this approach. Thisy  approach to TPS is referred to as the file-oriented approach. A more modern approach

y  is to develop an integrated set of application systems with all data stored in a sharedy  repository, i.e., the enterprise database. This approach is referred to as the database

y  approach.

y

  The file-oriented approachy  As indicated above, the file-oriented approach involves creating a set of files, as needed,y  for each transaction processing application such as sales or purchases. A set of COBOL

y   programs and data files are created to satisfy the information needs of a each application.y  As shown in the figure on the next page, each application's files and programs are created

y  and maintained independent of other applications. 

Drawbacks of the file-oriented approachy  The most significant drawback of the file-oriented approach is that there is no sharing of 

y  data across applications. For example, a marketing application would have to create itsy  own customer file, although a customer file already exists in the sales application.

y  Independence among applications results in data redundancy or duplication, which hasy

  many undesirable consequences. Apart from merely consuming more storage space, datay  duplication causes problems of data maintenance. A second drawback of the fileorientedy  approach is the proliferation of files which results from each application creating

y  its own files as needed. As the number of files increases, data maintenance becomesy  significantly more problematic. With several versions of the same file in different

y  applications, ensuring consistency of data across all applications becomes more difficulty  as the number of files multiplies. A third drawback of the file-oriented approach is the

y  length of time normally required for application development. Files needed for a new

Page 3: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 3/13

y  application must be created from scratch since sharing of existing files is not possible.y  A fourth and rather significant disadvantage of the file-oriented approach is the lack of 

y  independence between the data structures and the application programs that access thosey  data structures. As indicated earlier, the "data" division in the COBOL program defines

y  the data structures of all files used in the program. These data structures have to bey

  redefined in every COBOL program that accesses the same file.y  The Data Base Approachy  In contrast to the file-oriented approach, the data base approach centers around creating

y  an organization wide repository of data that all applications and all users can share.y  R ather than having multiple instances of the same file, each set of data is uniquely stored,

y  as shown in the figure that follows. A data base is an integrated repository of any  organization's data containing a series of interrelated data sets. The data sets are designed

y  to store data about entities such as customers, employees, and vendors, and also eventsy  such as sales that are really relationships between entities. A second advantage of the

y  data base approach, related to the first advantage, is that data inconsistencies are muchy  less likely to occur. . A third and very significant advantage of the data base approach

y is data independence. A fourth advantage of the database approach is that sharing of 

y  data and the data independence concept permit rapid application development. New

y  applications using data that already exists in the database can be very quickly developed.y  The time-consuming steps of defining the data structures and setting up files is

y  eliminated. The fifth and final advantage of the data base approach is that the importanty  functions of backup, control, and security are centralized. 

y  A database model or database schema is the structure or format of a database, described

in a formal language supported by the database management system, In other words, a"database model" is the application of a data model when used in conjunction with a

database management system.

y  Collage of five types of database models.

Page 4: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 4/13

y  Schemas are generally stored in a data dictionary. Although a schema is defined in textdatabase language, the term is often used to refer to a graphical depiction of the database

structure.[ 

A database model is a theory or specification describing how a database is structured and used.

Several such models have been suggested.

Common models include:

y  Hierarchical model 

y  Network model 

y  Relational model 

y  Entity-relationship 

y  Object-relational model 

y  Object model 

A data model is not just a way of structuring data: it also defines a set of operations that can be performed on the data. The relational model, for example, defines operations such as select,

 project, and join. Although these operations may not be explicit in a particular query language,they provide the foundation on which a query language is built.

Models

Various techniques are used to model data structure. Most database systems are built around one particular data model, although it is increasingly common for products to offer support for more

than one model. For any one logical model various physical implementations may be possible,and most products will offer the user some level of control in tuning the physical

implementation, since the choices that are made have a significant effect on performance. Anexample of this is the relational model: all serious implementations of the relational model allow

the creation of indexes which provide fast access to rows in a table if the values of certaincolumns are known.

COMPONENTS OF DATABASE SYSTEM 

A database system is composed of four components;

Data

Hardware

Software

Users

Page 5: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 5/13

which coordinate with each other to form an effective database system.

)LJ'DWD%DVH6\VWHP

1. Data - It is a very important component of the database system. Most of the organizations generate,

store and process 1arge amount of data. The data acts a bridge between the machine parts i.e. hardwareand software and the users which directly access it or access it through some application programs.

Data may be of different types. 

User Data - It consists of a table(s) of data called R elation(s) where Column(s) are called fields of 

attributes and rows are called R ecords for tables. A R elation must be structured properly. 

Metadata - A description of the structure of the database is known as Metadata. It basically means "data

about data". System Tables store the Metadata which includes. 

- Number of Tables and Table Names 

- Number of fields and field Names 

- Primary Key Fields 

Application Metadata - It stores the structure and format of Queries, reports and other applications

components. ' 

2. Hardware - The hardware consists of the secondary storage devices such as magnetic disks (hard disk,zip disk, floppy disks), optical disks (CD-R OM), magnetic tapes etc. on which data is stored together with

the Input/Output devices (mouse, keyboard, printers), processors, main memory etc. which are used for 

storing and retrieving the data in a fast and efficient manner. Since database can range from those of a

single user with a desktop computer to those on mainframe computers with thousand of users, therefore proper care should be taken for choosing appropriate hardware devices for a required database. 

3. Software - The Software part consists of DBMS which acts as a bridge between the user and the

database or in other words, software that interacts with the users, application programs, and database andfiles system of a particular storage media (hard disk, magnetic tapes etc.) to insert, update, delete andretrieve data. For performing these operations such as insertion, deletion and updation we can either use

Page 6: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 6/13

the Query Languages like SQL, QUEL, Gupta SQL or application softwares such as Visual 3asic,

Developer etc. 

4. Users - Users are those persons who need the information from the database to carry out their primary business responsibilities i.e. Personnel, Staff, Clerical, Managers, Executives etc. On the basis of the job

and requirements made by them they are provided access to the database totally or partially. 

The various types of users which can access the database are:- 

Database Administrators (DBA) 

Database Designers 

End Users 

Application Programmers 

Database Systems in the Organisation

A database consists of an organized collection of data for one or more

multiple uses. One way of classifying databases involves the type of 

content, for example: bibliographic, full-text, numeric, image. Other 

classification methods start from examining database models or database

architectures: see below. Software organizes the data in a databaseaccording to a database model. As of 2010 the relational model occurs

most commonly. Other models such as the hierarchical model and thenetwork model use a more explicit representation of relationships.

Types

Operational database

These databases store detailed data needed to support the operations of an entire organization.

They are also called subject-area databases (SADB), transaction databases, and productiondatabases. For example:

y  customer database

y  personal database

y  inventory database

y  accounting database

Page 7: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 7/13

 Analytical database

Analytic databases (a.k.a. OLAP- On Line Analytical Processing) are primarily static, read-only

databases which store archived, historical data used for analysis. For example, a company mightstore sales records over the last ten years in an analytic database and use that database to analyze

marketing strategies in relationship to demographics.

On the web, you will often see analytic databases in the form of inventory catalogs such as the

one shown previously from Amazon.com. An inventory catalog analytical database usually holdsdescriptive information about all available products in the inventory.

Web pages are generated dynamically by querying the list of available products in the inventory

against some search parameters. The dynamically-generated page will display the informationabout each item (such as title, author, ISBN) which is stored in the database.

Data warehouse

A data warehouse stores data from current and previous years ² data extracted from the various

operational databases of an organization. It becomes the central source of data that has beenscreened, edited, standardized and integrated so that it can be used by managers and other end-

user professionals throughout an organization. Data warehouses are characterized by being slowto insert into but fast to retrieve from. R ecent developments in data warehousing have led to the

use of a Shared nothing architecture to facilitate extreme scaling.

Distributed database

These are databases of local work-groups and departments at regional offices, branch offices,

manufacturing plants and other work sites. These databases can include segments of bothcommon operational and common user databases, as well as data generated and used only at auser¶s own site.

End-user database

These databases consist of a variety of data files developed by end-users at their workstations.

Examples of these are collections of documents in spreadsheets, word processing and evendownloaded files.

External database

These databases provide access to external, privately-owned data online ² available for a fee to

end-users and organizations from commercial services. Access to a wealth of information fromexternal database is available for a fee from commercial online services and with or without

charge from many sources in the Internet.

Page 8: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 8/13

Hypermedia databases on the web

These are a set of interconnected multimedia pages at a web-site. They consist of a home page

and other hyperlinked pages[citation needed ]

of multimedia or mixed media such as text, graphic, photographic images, video clips, audio etc.

Navigational database

In navigational databases, queries find objects primarily by following references from other 

objects. Traditionally navigational interfaces are procedural, though one could characterize somemodern systems like XPath as being simultaneously navigational and declarative.

In-memory databases

In-memory databases primarily rely on main memory for computer data storage. This contrasts

with database management systems which employ a disk-based storage mechanism. Main

memory databases are faster than disk-optimized databases since[citation needed ]

the internaloptimization algorithms are simpler and execute fewer CPU instructions. Accessing data inmemory provides faster and more predictable performance than disk. In applications whereresponse time is critical, such as telecommunications network equipment that operates

emergency systems, main memory databases are often used.

Document-oriented databases

Document-oriented databases are computer programs designed for document-orientedapplications. These systems may be implemented as a layer above a relational database or an

object database. As opposed to relational databases, document-based databases do not store data

in tables with uniform sized fields for each record. Instead, they store each record as a documentthat has certain characteristics. Any number of fields of any length can be added to a document.Fields can also contain multiple pieces of data.

Real-time databases

A real-time database is a processing system designed to handle workloads whose state may

change constantly. This differs from traditional databases containing persistent data, mostlyunaffected by time. For example, a stock market changes rapidly and dynamically. R eal-time

 processing means that a transaction is processed fast enough for the result to come back and beacted on right away. R eal-time databases are useful for accounting, banking, law, medical

records, multi-media, process control, reservation systems, and scientific data analysis. Ascomputers increase in power and can store more data, real-time databases become integrated into

society and are employed in many applications.

Page 9: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 9/13

Relational Database

The standard of business computing as of 2009, relational databases are the most commonly used

database today[citation needed ]

. It uses the table to structure information so that it can be readily andeasily searched through.

Data sharing

The ability to share the same data resource with multiple applications or users. It implies that thedata are stored in one or more servers in the network and that there is some software locking

mechanism that prevents the same set of data from being changed by two people at the sametime. Data sharing is a primary feature of a database management system (DBMS).

Data sharing is the practice of making data used for scholarly research available to other investigators. Many funding agencies, institutions, and publication venues have policies

regarding data sharing because transparency and openness are considered by many to be part of 

the scientific method. A number of funding agencies and science journals require authors of  peer-reviewed papers to share any supplemental information (raw data, statistical methods or source code) necessary to audit or reproduce published research. A great deal of scientific

research is not subject to data sharing requirements, and many of these policies have liberalexceptions. In the absence of any binding requirement, data sharing is at the discretion of the

scientists themselves. In addition, in certain situations agencies and institutions prohibit or severely limit data sharing to protect proprietary interests, national security, and patient/victim

confidentiality. Data sharing (especially photographs and graphic descriptions of animalresearch) may also be restricted to protect institutions and scientists from misuse of data for 

 political purposes by animal rights extremists.

RDBMS a Introduction

Database Management System

A Database Management System (DBMS) is a computer program for managing a permanent, self-

descriptive repository of data. This repository of data is called a database and is store in one or more

files. There are many reasons why you could use a DBMS:

y  Crash recovery; The database is protected from hardware crashes, disk media failures, and some

user errors

Page 10: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 10/13

y  Sharing between users; Multiple users can access the database at the same time

y  Sharing between applications; Multiple application programs can read and write data to the

same database

y  Security; Data can be protected against unauthorized read and write access

y  Integrity; You can specify rules that data must satisfy. A DBMS can control the quality of its data

over and above facilities that that may be provided by application programsy  Ex tensibility; Data may be added to the database without disrupting existing programs. Data can

be reorganized for faster performance.

y  Data distribution; The database may be partitioned across various sites, organizations, and

hardware platforms

An entire branch of computer science is devoted to studying DBMS issues and answering questions such

as:

y  What paradigm is most conducive it represents database structure?

y  What kind of language provides the most natural interaction?

y  How can a database capture more of the true meaning of its data?

y  How should a database be organized for maximum performance and flexibility?

Several DBMS paradigms are available: hierarchical, network, relational, and object-oriented.

Hierarchical and network DBMS bring the conceptual DBMS close to underlying physical data structures.

Thus they are efficient but difficult to use and fading in the marketplace. Relational DBMS dominate

todays marketplace. Relational DBMS present the database at a higher level of abstraction than

hierarchies and networks and are easy to use. Relational DBMS implementations are improving in

performance as they mature and use smarter optimization techniques.Object-oriented may be the

wave to the future

Relational Database Management System

A Relational Database Management System (RDBMS) provides a comprehensive and integrated

approach to information management.

A relational model provides the basis for a relational database. A relational model has three aspects:

y  Structures

Page 11: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 11/13

y  Operations

y  Integrity rules 

Structures consist of a collection of objects or relations that store data. An example of relation is a table.

You can store information in a table and use the table to retrieve and modify data.

Operations are used to manipulate data and structures in a database. When using operations. You must

adhere to a predefined set of integrity rules.

Integrity rules are laws that govern the operations allowed on data in a database. This ensures data

accuracy and consistency.

Relational database components include:

y  Table

y  Row

y  Column

y  Field

y  Primary key

y  Foreign key

Page 12: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 12/13

 

Figure 1-1. Relational database components

 A Table is a basic storage structure of an RDBMS and consists of columns and rows. A table represents

an entity. For example, the S_DEPT table stores information about the departments of an organization.

 A Row is a combination of column values in a table and is identified by a primary key. Rows are also

known as records. For example, a row in the table S_DEPT contains information about one department.

 A Column is a collection of one type of data in a table. Columns represent the attributes of an object.

Each column has a column name and contains values that are bound by the same type and size. For

example, a column in the table S_DEPT specifies the names of the departments in the organization.

 A Field is an intersection of a row and a column. A field contains one data value. If there is no data in the

field, the field is said to contain a NULL value.

Page 13: RDBMS UNIT-I

8/8/2019 RDBMS UNIT-I

http://slidepdf.com/reader/full/rdbms-unit-i 13/13