Unit 1 Data Base Concepts

29
7/29/2019 Unit 1 Data Base Concepts http://slidepdf.com/reader/full/unit-1-data-base-concepts 1/29 Database Systems Unit 1 Data Base Concepts 1.0 Objectives 1.1 Introduction 1.2 Introduction to Database 1.2.1 Data 1.2.2 Information 1.2.3 Database 1.2.4 DBMS (Database Management System) 1.2.5 Instance 1.2.6 Schema 1.2.7 Old file oriented approach 1.2.8 Advantages of DBMS over file oriented approach 1.3 Purpose of Database Systems 1.3.1 View of Data 1.3.2 Data Models 1.3.3 Data Definition Language 1.3.4 Data Manipulation Language 1.3.5 Transaction Management 1.3.6 Function of the database 1.3.7 Types of database 1.3.8 Storage Management 1.3.9 Database Administrator 1.3.10 Database Users 1.3.11 Components of DBMS 1.4 Relational Database Management System 1.4.1 Relation 1.4.2 Domain Definition 1.4.3 Relational Model 1.4.4 Concept of Keys 1.4.5 Candidate key 1.4.6 Primary key 1.4.7 Foreign key 1.4.8 Entity integrity and referential integrity 1.4.9 Key Constraints 1.4.9.1 Integrity Constraints 1.4.9.2 Domain Constraints 1.5 Summary 1

Transcript of Unit 1 Data Base Concepts

Page 1: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 1/29

Database Systems

Unit 1

Data Base Concepts

1.0 Objectives1.1 Introduction

1.2 Introduction to Database

1.2.1 Data

1.2.2 Information

1.2.3 Database

1.2.4 DBMS (Database Management System)

1.2.5 Instance

1.2.6 Schema

1.2.7 Old file oriented approach

1.2.8 Advantages of DBMS over file oriented approach

1.3 Purpose of Database Systems1.3.1 View of Data

1.3.2 Data Models

1.3.3 Data Definition Language

1.3.4 Data Manipulation Language

1.3.5 Transaction Management

1.3.6 Function of the database

1.3.7 Types of database

1.3.8 Storage Management

1.3.9 Database Administrator

1.3.10 Database Users

1.3.11 Components of DBMS1.4 Relational Database Management System

1.4.1 Relation

1.4.2 Domain Definition

1.4.3 Relational Model

1.4.4 Concept of Keys

1.4.5 Candidate key

1.4.6 Primary key

1.4.7 Foreign key

1.4.8 Entity integrity and referential integrity

1.4.9 Key Constraints

1.4.9.1 Integrity Constraints

1.4.9.2 Domain Constraints

1.5 Summary

1

Page 2: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 2/29

Data Base Concepts

1.0 Objectives

At the end of this unit, you should be able to-

• describe database and database management system

• compare database and file oriented approach

• describe various features of database

• describe the need and function of the database

• describe the concept of different keys

• describe relational model

• describe data integrity

1.1 Introduction

Data and its storage may be considered to be the heart of anyinformation system. Data has to be up-to-date, accurate,accessible in the required form and available to one or  perhapsmany users at the same time.

For data to be of value it must be presented in a form thatsupports the various operational, financial, managerial, decision-making, administrative and clerical activities within an

organization.

To meet these objectives data needs to be stored efficiently thatmeans we wish to avoid lengthy access times and withminimal duplication that means we wish to avoid lengthyupdate times and the possibility of  inconsistency andinaccuracy. For the data stored by a given organization to have

any value at all its integrity (consistency and accuracy) mustalways be assured.

In this unit we consider what is da ta ba se an d DBMS,different needs and functions of database and concepts related torelational database management system.

1.2 Introduction to Database

1.2.1 Data

2

Page 3: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 3/29

Database Systems

Data is a collection of facts, figures and statistics related to an object.Data can be processed to create useful information. Data is a valuableasset for an organization. Data can be used by the managers to

 perform effective and successful operations of management. It

 provides a view of past activities related to the rise and fall of anorganization. It also enables the user to make better decision for future. Data is very useful for generating reports, graphs and statistics.

Example

Students fill an admission form when they get admission in college.The form consists of raw facts about the students. These raw facts arestudent's name, father name, address etc. The purpose of collectingthis data is to maintain the records of the students during their study

 period in the college. Figure 1 shows the relation of data and

information.

Figure 1

1.2.2 Information

The manipulated and processed form of data is called information. Itis more meaningful than data. It is used for making decisions. Asshown in figure1, data is used as input for processing and informationis output of this processing.

Example

Data collected from census is used to generate different type of information. The government can use it to determine the literacy ratein the country. Government can use the information in importantdecision to improve literacy rate.

1.2.3 Database

A database is an organized collection of data and the records, which isstored in a system, usually a computer. The organization of data isachieved by structuring it according to the model of the database.

There are three main types of database models which include

3

Data

Input

or

Information

output

orProcess

Page 4: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 4/29

Data Base Concepts

relational model, network model and hierarchical model.The functioning of the database is based on the software which isknown as database management system. It facilitates the process of organization of data according to the model of the database. For 

accessing the database the query language is used which is determined by the type of model.

Databases are used by a number of organizations for proper handlingof their data. Each company has its own database which has thefunctions according to the needs of the company.

1.2.4 DBMS (Database Management System)

A database management system (DBMS) is a software system thatintegrates data in storage and provides easy access to them. The data

themselves are placed on disk in a database, which can be thought of as an integrated collection of related files. Although not all databasesare organized identically, many of them are composed of files, recordsand fields. For instance, the Product file contains five records oneeach for skis, boots, poles, bindings, and wax. Finally each recordconsists of distinct types of data called fields. The product file storesfour fields for each record product name, product number, supplier,and price.

PRODUCT

Product_name Product_ number 

Supplier Price

skis 1100 Raja Pvt. Ltd. 110

 boots 1200 Vishwa Pvt. Ltd. 210

 poles 1300 Krishna Pvt. Ltd. 2100

 bindings 1400 Rama Pvt. Ltd. 214

wax 1500 Rana Pvt. Ltd. 234

Database management software enables queries and reports to be prepared by extracting information from one file at a time, and, as we

will shortly see, from several interrelated files concurrently. Databasemanagement system (DBMS) is a software product designed tointegrate data and provide easy access to them. Database is anintegrated collection of related data files and database managementsystem is a computer program for database management that linksdata in related files through common fields. Database managementsystem stores data in relevant form and give easy access to them. Thedata placed on disk themselves.

1.2.5 Instance

4

Page 5: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 5/29

Database Systems

The database instance refers to a complete database environment. Itincludes RDBMS software, table structure, stored procedures andother functions. It is normally used when administrators tend todescribe multiple instances of the same database. It is also called as

environment in technical terms. We can better understand its workingswith the help of an example. The example is of an organization thathas an employee database. This database will have three instances,which are

•  production that is used for storing live data

•  pre-production which is used to test new functionality prior torelease for production

• development which is used by database developers in order tocreate new functionality

1.2.6 Schema

A schema is a collection of database objects. A schema is owned by adatabase user and has the same name as that user. Schema objects arelogical structures created by users to contain, or reference, their data.Schema objects include structures like tables, views, and indexes.

The overall design of a database is called database schema. For 

example, the database consists of information about a set of customersand accounts and the relationship between them. It is similar tovariable along with its type information in a program.

Types of Schemas (partitioned according to levels of abstraction):

a. Physical schema:

It is database design at the physical level. It is hidden below logical schema, and can be changed easily withoutaffecting application programs.

 b. Logical schema:

It is database design at the logical level. Programmersconstruct applications using logical schema. It is by far themost important schema, in terms of its effect on application

 programs.

c. Subschema:

It is schema at view level. It can be combined as logical

schema but with only part of the complete database. This

5

Page 6: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 6/29

Data Base Concepts

schema provides us the facility to control the accessdatabase by different users.

1.2.7 Old file oriented approach

A File is a collection of data about a single entity. Files are typicallydesigned to meet needs of a particular department or user group. Filesare also typically designed to be part of a particular computer application.

Advantages

• Files are relatively easy to design and implement since they arenormally based on a single application or information system.

• The processing speed is faster than other ways of storing data.

Disadvantages

• Program-data dependence.

• Duplication of data.

• Limited data sharing.

• Lengthy program and system development time.

• Excessive program maintenance when the system changed.

• Duplication of data items in multiple files. Duplication canaffect on input, maintenance, storage and possibly dataintegrity problems.

• Inflexibility and non-scalability. Since the conventional filesare designed to support single application, the original filestructure cannot support the new requirements.

Today almost everywhere the file system has been replaced bydatabase system and applications.

1.2.8 Advantages of DBMS over file oriented approach

There are three main features of a database management system thatmake it attractive to use a DBMS in preference to more conventionalsoftware. These features are centralized data management, dataindependence, and system integration.

6

Page 7: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 7/29

Database Systems

In a database system, the data is managed by the DBMS and all accessto the data is through the DBMS providing a key to effective data

 processing. This contrasts with conventional data processing systemswhere each application program has direct access to the data it reads

or manipulates. In a conventional Data Processing system, anorganization is likely to have several files of related data that are

 processed by several different application programs.

In conventional data processing application programs, the programsusually are based on a considerable knowledge of data structure andformat. In such environment any change of data structure or formatwould require appropriate changes to the application programs. Thesechanges could be as small as the following:

1. Coding of some field is changed. For example, a null value

that was coded as -1 is now coded as -9999.

2. A new field is added to the records.

3. The length of one of the fields is changed. For example, themaximum number of digits in a telephone number field or a

 postcode field needs to be changed.

4. The field on which the file is sorted is changed.

If some major changes were to be made to the data, the application programs may need to be rewritten. In a database system, the databasemanagement system provides the interface between the application

 programs and the data. When changes are made to the datarepresentation, the metadata maintained by the DBMS is changed butthe DBMS continues to provide data to application programs in the

 previously used way. The DBMS handles the task of transformation of data wherever necessary.

This independence between the programs and the data is called dataindependence. Data independence is important because every time

some change needs to be made to the data structure, the programs thatwere being used before the change would continue to work. To provide a high degree of data independence, a DBMS must include asophisticated metadata management system.

In DBMS, all files are integrated into one system thus reducingredundancies and making data management more efficient. Inaddition, DBMS provides centralized control of the operational data.Some of the advantages of data independence, integration andcentralized control are:

1. Redundancies and inconsistencies can be reduced

7

Page 8: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 8/29

Data Base Concepts

In conventional data systems, an organization often builds a collection of application programs oftencreated by different programmers and requiring

different components of the operational data of theorganization. The data in conventional data systems isoften not centralized. Some applications may requiredata to be combined from several systems. Theseseveral systems could well have data that is redundantas well as inconsistent (that is, different copies of thesame data may have different values). Datainconsistencies are often encountered in everyday life.For example, we have all come across situations whena new address is communicated to an organization thatwe deal with (e.g. a bank, or Telecom, or a gas

company), we find that some of the communicationsfrom that organization are received at the new addresswhile others continue to be mailed to the old address.Combining all the data in a database would involvereduction in redundancy as well as inconsistency. Italso is likely to reduce the costs for collection, storageand updating of data.

2. Better service to the Users

A DBMS is often used to provide better service to theusers. In conventional systems, availability of information is often poor since it normally is difficultto obtain information that the existing systems were notdesigned for. Once several conventional systems arecombined to form one centralized data base, theavailability of information and its up-to-datedness islikely to improve since the data can now be shared andthe DBMS makes it easy to respond to unforeseeninformation requests.

Centralizing the data in a database also often meansthat users can obtain new and combined informationthat would have been impossible to obtain otherwise.Also, use of a DBMS should allow users that do notknow programming to interact with the data moreeasily.

The ability to quickly obtain new and combinedinformation is becoming increasingly important in anenvironment where various levels of governments arerequiring organizations to provide more and more

information about their activities. An organization

8

Page 9: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 9/29

Database Systems

running a conventional data processing system wouldrequire new programs to be written (or the informationcompiled manually) to meet every new demand.

3. Flexibility of the system is improved

Changes are often necessary to the contents of datastored in any system. These changes are more easilymade in a database than in a conventional system inthat these changes do not need to have any impact onapplication programs.

4. Cost of developing and maintaining systems is lower

As noted earlier, it is much easier to respond to

unforeseen requests when the data is centralized in adatabase than when it is stored in conventional filesystems. Although the initial cost of setting up of adatabase can be large, one normally expects the overallcost of setting up a database and developing andmaintaining application programs to be lower than for similar service using conventional systems since the

 productivity of programmers can be substantiallyhigher in using non-procedural languages that have

 been developed with modern DBMS than using procedural languages.

5. Standards can be enforced

Since all access to the database must be through theDBMS, standards are easier to enforce. Standards mayrelate to the naming of the data, the format of the data,the structure of the data etc.

6. Security can be improved

In conventional systems, applications are developed inan ad hoc manner. Often different system of anorganization would access different components of theoperational data. In such an environment, enforcingsecurity can be quite difficult.

Setting up of a database makes it easier to enforcesecurity restrictions since the data is now centralized. Itis easier to control that has access to what parts of thedatabase. However, setting up a database can also makeit easier for a determined person to breach security. We

will discuss this in the next section.

9

Page 10: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 10/29

Data Base Concepts

7. Integrity can be improved

Since the data of the organization using a database

approach is centralized and would be used by a number of users at a time, it is essential to enforce integritycontrols.

Integrity may be compromised in many ways. For example, someone may make a mistake in data inputand the salary of a full-time employee may be input as$4,000 rather than $40,000. A student may be shown tohave borrowed books but has no enrolment. Salary of astaff member in one department may be coming out of the budget of another department.

If a number of users are allowed to update the samedata item at the same time, there is a possibility that theresult of the updates is not quite what was intended.For example, in an airline DBMS we could have asituation where the number of bookings made is larger than the capacity of the aircraft that is to be used for theflight. Controls therefore must be introduced to preventsuch errors to occur because of concurrent updatingactivities. However, since all data is stored only once, itis often easier to maintain integrity than inconventional systems.

8. Enterprise requirements can be identified

All enterprises have sections and departments and eachof these units often consider the work of their unit asthe most important and therefore consider their needsas the most important. Once a database has been set upwith centralized control, it will be necessary to identify

enterprise requirements and to balance the needs of competing units. It may become necessary to ignoresome requests for information if they conflict withhigher priority needs of the enterprise.

9. Data model must be developed

Perhaps the most important advantage of setting up adatabase system is the requirement that an overall datamodel for the enterprise be built. In conventionalsystems, it is more likely that files will be designed as

needs of particular applications demand. The overall

10

Page 11: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 11/29

Database Systems

view is often not considered. Building an overall viewof the enterprise data, although often an expensiveexercise is usually very cost-effective in the long term.

1.3 Purpose of Database Systems

1.3.1 View of Data

We now discuss a conceptual framework for a DBMS. Severaldifferent frameworks have been suggested over the last several years.For example, a framework may be developed based on the functionsthat the various components of a DBMS must provide to its users. Itmay also be based on different views of data that are possible within aDBMS. We consider the latter approach.

A commonly used view of data approach is the three-level architecturesuggested by ANSI/SPARC (American National StandardsInstitute/Standards Planning and Requirements Committee).ANSI/SPARC produced an interim report in 1972 followed by a finalreport in 1977. The reports proposed an architectural framework for databases.

Under this approach, a database is considered as containing data aboutan enterprise. The three levels of the architecture are three differentviews of the data:

1 1. External – individual user view23 2. Conceptual – community user view

4 3. Internal – physical or storage view

5The three level database architecture allows a clear separation of theinformation of conceptual view from the external data representationand from the physical data structure layout. A database system that is

able to separate the three different views of data is likely to be flexibleand adaptable.

The external level is the view that the individual user of the databasehas. This view is often a restricted view of the database and the samedatabase may provide a number of different views for different classesof users. In general, the end users and even the applications

 programmers are only interested in a subset of the database. For example, a department head may only be interested in thedepartmental finances and student enrolments but not the libraryinformation. The librarian would not be expected to have any interest

11

Page 12: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 12/29

Data Base Concepts

in the information about academic staff. The payroll office wouldhave no interest in student enrolments.

The conceptual view is the information model of the enterprise and

contains the view of the whole enterprise without any concern for the physical implementation. This view is normally more stable than theother two views. In a database, it may be desirable to change theinternal view to improve performance while there has been no changein the conceptual view of the database. The conceptual view is theoverall community view of the database and it includes all theinformation that is going to be represented in the database. Theconceptual view is defined by the conceptual schema which includesdefinitions of each of the various types of data.

The internal view is the view about the actual physical storage of 

data. It tells us what data is stored in the database and how. At leastthe following aspects are considered at this level:

1. Storage allocation

Example - B-trees, hashing etc.

2. Access paths

Example - Specification of primary and secondary keys,indexes and pointers and sequencing.

3. Miscellaneous

Example - Data compression and encryption techniques,optimization of the internal structures.

Efficiency considerations are the most important at this level and thedata structures are chosen to provide an efficient database. Theinternal view does not deal with the physical devices directly. Insteadit views a physical device as a collection of physical pages and

allocates space in terms of logical pages.

The separation of the conceptual view from the internal view enablesus to provide a logical description of the database without the need tospecify physical structures. This is often called physical dataindependence. Separating the external views from the conceptual viewenables us to change the conceptual view without affecting theexternal views. This separation is sometimes called logical dataindependence.

Assuming the three level view of the database, a number of mappings

are needed to enable the users working with one of the external views.

12

Page 13: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 13/29

Database Systems

For example, the payroll office may have an external view of thedatabase that consists of the following information only:

1 1. Staff number, name and address.

23 2. Staff tax information e.g. number of dependents.

4 3. Staff bank information where salary is deposited.

5 4. Staff employment status, salary level, leaves informationetc.

The conceptual view of the database may contain academic staff,general staff, casual staff etc. A mapping will need to be createdwhere all the staff in the different categories is combined into one

category for the payroll office. The conceptual view would includeinformation about each staff’s position, the date employment started,full-time or part-time, etc. This will need to be mapped to the salarylevel for the salary office. Also, if there is some change in theconceptual view, the external view can stay the same if the mapping ischanged.

1.3.2 Data Models

Before the data available in an enterprise can be put in a DBMS, anoverall abstract view of the enterprise data must be developed. Theview can then be translated into a form that is acceptable by theDBMS. Although at first sight the task may appear trivial, it is often avery complex process. The complexity of mapping the enterprise datato a database management system can be reduced by dividing the

 process into two phases. The first phase as noted above involves building an overall view (or model) of the real world which is theenterprise (often called the logical database design). The objective of the model is to represent, as accurately as possible, the informationstructures of the enterprise that are of interest. This model issometimes called the enterprise conceptual schema and the process of 

developing the model may be considered as the requirements analysisof the database development life cycle. This model is then mapped inthe second phase to the user schema appropriate for the databasesystem to be used. The logical design process is an abstraction processwhich captures the meaning of the enterprise data without gettinginvolved in the details of individual data values.

The process is somewhat similar to modeling in the physical sciences.In logical database design, similar to modeling in the physicalsciences like physics and chemistry, a model is built to enhanceunderstanding and abstracting details. A model cannot be expected to

 provide complete knowledge (except for very simple situations) but a

13

Page 14: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 14/29

Data Base Concepts

good model should provide a reasonable interpretation of the real-lifesituation. For example, a model of employee data in an enterprise maynot be able to capture the knowledge that employees Amit andAbhilasha are married to each other. We accept such imperfections of 

the model since we want to keep the model as simple as possible. It isclearly impossible (and possibly undesirable) to record every available

 piece of information that is available in an enterprise. We only desirethat the meaning captured by a data model should be adequate for the

 purpose that the data is to be used for.

The person organizing the data to set up the database not only has tomodel the enterprise but also has to consider the efficiency andconstraints of the DBMS although the two-phase process separatesthose two tasks. Nevertheless, we only consider data models that can

 be implemented on computers.

When the database is complex, the logical database design phase may be very difficult. A number of techniques are available for modelingdata but we will discuss only one such technique that is, we believe,easy to understand. The technique uses a convenient representationthat enables the designer to view the data from the point of view of thewhole enterprise. This well known technique is called the entity-relationship model. We discuss it now.

1.3.3 Data Definition Language

The first step in creating a database is data definition. Data definitioninvolves telling the DBMS the properties of the data that are to go intothe database how big the records are, what type of data each of thefields of the records contain, and so on. During the data definition

 process, a screen form, or template, is created for each file in thedatabase. When the template is finished, it is used for entering data.Each database file that needs to be created will have its owndistinctive template.

As you are creating the data definition for each file, the DBMS will

ask for the following types of information: The name of each field, themaximum length of each field. The type of data (text,numeric, date etc) each field will store. The finished template iscommonly referred to as a file structure. For example suppose you'veinformed your PC's relational database program that you want tocreate a file called inventory. The program will ask you to describeeach data field of the records that will go into the file. The process of describing the characteristics of data that are to be handled by adatabase management system is known as Data definition.

1.3.4 Data Manipulation Language

14

Page 15: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 15/29

Database Systems

The Data Manipulation Language (DML) is used to retrieve, insertand modify database information. These commands will be used by alldatabase users during the routine operation of the database.

1.3.5 Transaction Management

A transaction is a sequence of database operations that represents alogical unit of work and that accesses a database and transforms itfrom one state to another.

A transition can update a record, delete (or) modify a set of recordsetc.

1.3.6 Function of the database

1. Shared – 

Data in a database are shared among different users andapplications.

2. Persistence – 

Data in a database exist permanently in the sense the data canlive beyond the scope of the process that created it.

3. Validity / Integrity / Correctness – 

Data should be correct with Respect to the real world’s entitythat they represent.

4. Security – 

Data should be protected from unauthorized access.

5. Consistency-

Whenever more than are database represents related real – 

world valves, the valves should be consistent with respect tothe relationship.

6. Non –redundancy – 

 No two data items in a database should represent the same realworld entity.

7. Independence – 

The three levels in the schema (internal, conceptual andexternal) should be independent of each other so that the

15

Page 16: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 16/29

Data Base Concepts

changes in the schema at one level should not affect the other levels.

1.3.7 Types of database

A DBMS can take any one of the several approaches to manage data.Each approach constitutes a database model. A data model is acollection of descriptions of data structures and their contained fields,together with the operations or functions that manipulate them. A datamodel is a comprehensive scheme for describing how data is to berepresented for manipulation by humans or computer programs. Allthorough representation details the types of data, the topologicalarrangements of data, spatial and temporal maps onto which data can

 be projected, and the operations and structures that can be invoked to

handle data and its maps. The various databases are the following:

• Relational Database – 

Data model based on tables.

• Network Database – 

Data model based on graphs with records as nodes andrelationships between records as edges.

• Hierarchical Database – 

Data model based on trees.

• Object-Oriented Database – 

Data model based on the object-oriented programming paradigm.

1.3.8 Storage Management

The DBMS provides a mechanism for management of permanentstorage of the data. The internal schema defines how the data should

 be stored by the storage management mechanism and this storagemanager interface with the operating system to access the physicalstorage.

1.3.9 Database Administrator

DBA stands for database administrator ; he is a person who isresponsible for the features of a database like database recovery,

integrity, availability, security and so on. DBA has to check these

16

Page 17: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 17/29

Database Systems

features in order to maintain the data base. These features arementioned as follows:

• Recoverability (disaster recovery):

Make recovery plans, generate backups as well as test theseBackups.

• Integrity:

Confirming or assisting to make sure that the data is reliable,integrated and correct.

• Security:

Defining or implementing the access control to the databaseand check that there is no unauthorized access to database.

• Availability:

Make sure that the data is available all the time to the users i.e.maximize visibility.

• Performance:

Make sure that the data does not consume more onlineresponse times and it does not make unattended programs torun for an unusable time.

• Development and testing support:

Assisting programmers and engineers to efficiently make useof the database.

The role of a database administrator has altered with respect to the

expertise and technology of database management systems as well asthe requirements of the database owners.

The duties of a database administrator (DBA) differ and depend uponthe job description, job specification and the technical capabilities of the DBA. It is DBA primary job to make disaster recovery plans liketaking and testing  backups, performance analysis and take part indatabase design.

Following are some roles of DBA:

17

Page 18: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 18/29

Data Base Concepts

• Installing new or update software:

DBA job is to install new editions of DBMS software in order to maintain and keep the system up to date.

• Configuration of hardware & software:

DBA should work with system administrator in order toconfigure hardware and software.

• Security administration:

One of the major responsibilities of DBA is to secure thedatabase from unauthorized access. He can add or remove theusers and consistently check security problems.

• Data analysis:

The DBA will regularly check and analyze the data and makeappropriate suggestions with respect to efficiency and

 performance of the data storage.

• Database design:

When the database design is in its initial stage then DBA can

 play a significant role. Because of his participation through outthe design phase of database most of the problems that mighttake place can be removed.

1.3.10 Database Users

The users are the people who manage the databases and performdifferent operations on the databases in the database system.

There are several categories of database users.

1. Casual Database Users:

These users do not access database on regular basis but theyaccess the database occasionally. There is the possibility thatthey need different information each time or you can say theyaccess different data each time. Casual users do not learn much

 because every time they learn few facilities.

2. Native or Parametric Database Users: 

18

Page 19: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 19/29

Database Systems

These users constantly query and update the database usingcanned transactions. These users perform different types of task. For example, clerk of a  bank check account balances,clerk of an airline reservation company make reservations on

requests. These users do not need to learn much about thefacilities provided by DBMS. They just have to understanduser interfaces.

3. Sophisticated Database Users:

Scientists, engineers, and others who are familiar with theservices of DBMS to implement their applications are includedin this category.

4. Standalone Database users:

Job of these users is to maintain database by using ready-made programs and tools.

1.3.11 Components of DBMS

Figure 2

The basic components of a DBMS can be divided into threesubsystems:

1. Design Tools:

Provide features for creating the database and variousapplications, forms and reports.

2. Runtime facilities:

Process the applications created by the design tools.

19

The DBMS provide the user interfaceto the data.

OperatingSystem

DBMSEngine

Design ToolsTable creationQuery creationReport creation

Procedural language

Run time facilitiesForm processor Query processor 

Report writer Procedural runtime

Page 20: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 20/29

Data Base Concepts

3. DBMS Engine:

Translates between the design tools and runtime facilities and

the data.

1.4 Relational Database Management System

1.4.1 Relation

A database relation is a predefined row/column format for storinginformation in a relational database. Relations are equivalent to tables.

1.4.2 Domain Definition

In database technology, domain refers to the description of anattribute's allowed values. The physical description is a set of valuesthe attribute can have, and the semantic, or logical description is themeaning of the attribute.

1.4.3 Relational Model

Relational data model is the most commonly used data model todesign the database. In 1970, Dr. Codd gave the concept of relationalmodel, while he was working as a researcher at IBM. The relationalmodel is based on mathematical theory, and therefore, has a solidtheoretical foundation. This model represents a database as collectionof relations, which are physically represented as tables or two-dimensional arrays. Similarly, the attributes are represented bycolumns of table and each row in a table represents a collection of related data values for a particular instance of an entity.

The relational data model consists of the following three components.

Data Structure: 

Data of various types can be organized in the form of tables or relations.

Data Manipulation: 

Powerful operations can be performed to manipulate data storedin the relations.

Data Integrity: 

Data integrity rules can be applied to maintain data accuracy and

data validity.

20

Page 21: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 21/29

Database Systems

A database that contains multiple tables to store dataand relationships can be created on the common fields of tables, iscalled relational database. The data in relational database is

represented in the form of tables. In relational database, table is the basic structure in which data is stored.

Relational Terminology

• Relation

• Table

• Table or result set

• Attribute

• Field

• Column

• Tuple

• Record

• Row

Figure 3

The entire structure is said to be, a relation. Each row of data is a tuple(rhymes with "couple").

21

Page 22: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 22/29

Data Base Concepts

Technically, each row is an n-tuple, but the "n-" is usually dropped.The number of tuples in a relation determines its cardinality. Eachcolumn in the tuple is called an attribute. The number of attributes in arelation determines its degree. Figure shows the example of degree

and cardinality.

Figure 4

The relation is divided into two sections, the heading and the body.The tuples make up the body, while the heading is composed of, well,the heading. Note that in its relational representation the label for eachattribute is composed of two terms separated by a colon.

1.4.4 Concept of Keys

A key is a field or combination of fields used to identify a record.When a key uniquely identifies a record it is referred to as the primarykey.

1.4.5 Candidate key

A candidate key is a combination of attributes that can be uniquely

used to identify a database record without any extraneous data. Eachtable may have one or more candidate keys. One of these candidatekeys is selected as the table primary key.

1.4.6 Primary key

The primary key of a relational table uniquely identifies each record inthe table. It can either be a normal attribute that is guaranteed to beunique (such as Social Security Number in a table with no more thanone record per person) or it can be generated by the DBMS (such as aglobally unique identifier, or GUID, in Microsoft SQL Server).

22

Page 23: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 23/29

Database Systems

Primary keys may consist of a single attribute or multiple attributes incombination.

Example

Imagine we have a STUDENTS table that contains a record for eachstudent at a university. The student's unique student ID number would

 be a good choice for a primary key in the STUDENTS table. Thestudent's first and last name would not be a good choice, as there isalways the chance that more than one student might have the samename.

1.4.7 Foreign key

A foreign key is a field in a relational table that matches the primary

key column of another table. The foreign key can be used to cross-reference tables.

1.4.8 Entity integrity and referential integrity

In the relational data model, entity integrity is one of the threeinherent integrity rules. Entity integrity is an integrity rule whichstates that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null.A direct consequence of this integrity rule is that duplicate rows areforbidden in a table. If each value of a primary key must be unique noduplicate rows can logically appear in a table. The NOT NULLcharacteristic of a primary key ensures that a value can be used toidentify all rows in a table.

Referential integrity is a database concept that ensures thatrelationships between tables remain consistent. When one table has aforeign key to another table, the concept of referential integrity statesthat you may not add a record to the table that contains the foreign keyunless there is a corresponding record in the linked table. It alsoincludes the techniques known as cascading update and cascading

delete, which ensure that changes made to the linked table arereflected in the primary table.Employees Table

Emp_name City Manager_no

Amit Jodhpur 12

Suresh Jabalpur 11

Anil Raipur 13

Deepak Udaipur 11

Managers Table

23

Page 24: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 24/29

Data Base Concepts

Manager_no name

11 Nisha

12 Aparna

13 Arpana

14 Neha

Consider the situation where we have two tables: Employees andManagers. The Employees table has a foreign key(Manager_no)attribute which points to the record for that employee’s manager in theManagers table and in Managers table the Manager_no is a primarykey that means Manger_no column(field) is used to establish relation

 between Employees and Managers. Referential integrity enforces thefollowing three rules:

1. We may not add a record to the Employees table unless theManaged By attributes points to a valid record in the Managerstable.

2. If the primary key for a record in the Managers table changes,all corresponding records in the Employees table must bemodified using a cascading update.

3. If a record in the Managers table is deleted, all correspondingrecords in the Employees table must be deleted using acascading delete.

1.4.9 Key Constraints

1.4.9.1 Integrity Constraints

1. Integrity constraints provide a way of ensuring that changesmade to the database by authorized users do not result in a lossof data consistency.

2. We saw a form of integrity constraint with E-R models:

• Key declarations: 

Stipulation that certain attributes form a candidatekey for the entity set.

• Form of a relationship: 

Mapping cardinalities 1-1, 1-many and many-many.

3. An integrity constraint can be any arbitrary predicate applied

to the database.

24

Page 25: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 25/29

Database Systems

4. They may be costly to evaluate, so we will only consider integrity constraints that can be tested with minimal overhead.

1.4.9.2 Domain Constraints

1. A domain of possible values should be associated with everyattribute. These domain constraints are the most basic form of integrity constraint. They are easy to test for when data isentered.

2. Domain types

1. Attributes may have the same domain, Example- cname and employee-name.

2. It is not as clear whether bname and cname domainsought to be distinct.

3. At the implementation level, they are both character strings.

4. At the conceptual level, we do not expect customers tohave the same names as branches, in general.

5. Strong typing of domains allows us to test for valuesinserted, and whether queries make sense. Newer systems, particularly object-oriented database systems,offer a rich set of domain types that can be extendedeasily.

25

Page 26: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 26/29

Data Base Concepts

Activity 1

Objective Questions

1. Candidate key may be a-

a. Primary key

b. Composite key

c. Foreign key

d. Composite key

2. File processing systems have important limitations-

a. Data is separated

b. Data is isolated

c. Data is often duplicated

d. All of the above

3. Data manipulation is-

a. Retrieval of information from the database

b. Insertion of new information into the database

c. Deletion of information in the database

d. All of the above

4. Concept of foreign key is used in -

a. Domain constraint

b. Integrity constraint

c. Both a and b

d. None of the above

5. Relational model structure is defined by -

a. relations, tuples and attributes

26

Page 27: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 27/29

Database Systems

b. files, records and fields

c. table, rows and columns

d. All of the above

Activity 2

Answer the following question in 50 words-

1. What is the need of databases? Explain. ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________ 

2. Describe different types of databases. ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________ 

 ____________________________________________ 

3. What do you understand by functions of DML and DDL?

 ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________ 

4. What is foreign key? ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________ 

5. What are key constraints? Explain. ____________________________________________ 

 ____________________________________________ 

27

Page 28: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 28/29

Data Base Concepts

 ____________________________________________  ____________________________________________  ____________________________________________  ____________________________________________ 

Activity 3

Answer the following question in 150 words-

1. Explain the advantages of DBMS over filesystems.

2. Explain the role of primary key in RDBMSwith the help of example.

3. What do you understand by relationalmodel? Explain.

4. Explain the role of DBA with the help of suitable example.

5. Describe the different types of databaseusers with their characteristics.

Answers-

Activity 1

1. a

2. d

3. d

4. b

5. d

1.5 Summary

28

Page 29: Unit 1 Data Base Concepts

7/29/2019 Unit 1 Data Base Concepts

http://slidepdf.com/reader/full/unit-1-data-base-concepts 29/29

Database Systems

A database is an organized collection of data and the records, whichis stored in a system, usually a computer. The organization of data isachieved by structuring it according to the model of the database.

A database management system (DBMS) is a software system thatintegrates data in storage and provides easy access to them. The datathemselves are placed on disk in a database, which can be thought of as an integrated collection of related files. Although not all databasesare organized identically, many of them are composed of files, recordsand fields.

A DBMS can take any one of the several approaches to manage data.Each approach constitutes a database model. A data model is acollection of descriptions of data structures and their contained fields,together with the operations or functions that manipulate them. A data

model is a comprehensive scheme for describing how data is to berepresented for manipulation by humans or computer programs.

DBA stands for database administrator; he is a person who isresponsible for the features of a database like database recovery,integrity, availability, security and so on. DBA has to check thesefeatures in order to maintain the data base.

A key is a field or combination of fields used to identify a record.When a key uniquely identifies a record it is referred to as theprimary key.

Entity integrity is an integrity rule which states that every table musthave a primary key and that the column or columns chosen to be the

 primary key should be unique and not null.

Referential integrity is a database concept that ensures thatrelationships between tables remain consistent. When one table has aforeign key to another table, the concept of referential integrity statesthat you may not add a record to the table that contains the foreign keyunless there is a corresponding record in the linked table. It also

includes the techniques known as cascading update and cascadingdelete, which ensure that changes made to the linked table arereflected in the primary table.

Integrity constraints provide a way of ensuring that changes made tothe database by authorized users do not result in a loss of dataconsistency. A domain of possible values should be associated with every attribute.These domain constraints are the most basic form of integrityconstraint. They are easy to test for when data is entered.