Top Banner
06/06/22 Rajesh.... 1 Database Basics by Database Basics by Rajesh……………….. Rajesh……………….. Faculty, Faculty, MCA Course, B.R.A.BIHAR MCA Course, B.R.A.BIHAR UNIVERSITY, MUZAFFARPUR, BIHAR UNIVERSITY, MUZAFFARPUR, BIHAR
32
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Database Basics

04/07/23 Rajesh.... 1

Database Basics by Database Basics by Rajesh………………..Rajesh………………..

Faculty,Faculty,MCA Course, B.R.A.BIHAR UNIVERSITY, MCA Course, B.R.A.BIHAR UNIVERSITY,

MUZAFFARPUR, BIHARMUZAFFARPUR, BIHAR

Page 2: Database Basics

04/07/23 Rajesh.... 2

Database and Information Systems• An information system is a well-coordinated collection

of resources that gather and transform data into information products and services that help the enterprise perform its designed functions.– retrieves, updates and deletes these facts– derives other facts from existing ones

• Data - raw facts/details of the model

• DATABASE- A shared collection of logically related data (and a description of this data), designed to meet the organisation needs of an organisation

• The Database Management System (DBMS) - software that enables users to define, create and maintain the database and provides controlled access to the database

Page 3: Database Basics

04/07/23 Rajesh.... 3

Introducing the Database• Data versus Information

– Data constitute building blocks of information

– Information produced by processing data– Information reveals meaning of data– Good, timely, relevant information key to

decision making– Good decision making key to

organizational survival

Page 4: Database Basics

04/07/23 Rajesh.... 4

Database• A database is a logically coherent

collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose.

Page 5: Database Basics

04/07/23 Rajesh.... 5

DBMS• It is a collection of programs that

enables user to create and maintain a database. In other words it is general-purpose software that provides the users with the processes of defining, constructing and manipulating the database for various applications.

What is a Database system?The database and DBMS software together is called as Database system.

Page 6: Database Basics

04/07/23 Rajesh.... 6

Functions of a DBMS Data storage, retrieval, update

A user-accessible catalog

Transaction support

Concurrency control

Recovery services

Authorisation services

Support for data communication

Integrity services

Data independence

Page 7: Database Basics

04/07/23 Rajesh.... 7

Interaction of DBMS with Operating System

DISK MANAGER

DatabasePhysical record

occurrences

DBMS

FILE MANAGER

request for stored record

request for stored page

disk I/O operation

returned stored record

returned stored page

retrieved data

Page 8: Database Basics

04/07/23 Rajesh.... 8

Data Models, Schemas and Instances

Specifies the allowable logical structures and operations in a database. A DBMS operates always according to a specific data model eg relational

The description of a database for a particular universe of discourse which follows the rules layered down by the data model supported by the target DBMS

The data in the database at a particular moment in time

Data Model

Database Schema (intension)

Database Instance (extension)

Page 9: Database Basics

04/07/23 Rajesh.... 9

Advantages of DBMS• Sharing of data• Enforcement of security• Enforcement of development and maintenance

standards• Reduction of redundancy• Avoidance of inconsistency across files• Maintenance of integrity• Data independence

Page 10: Database Basics

04/07/23 Rajesh.... 10

Disadvantages of DBMS

• size• complexity• cost• Additional hardware costs• Higher impact of failure• Recovery more difficult

Page 11: Database Basics

04/07/23 Rajesh.... 11

Maintaining a Database System - the Task of the DBA

• Maintaining information structure of the database (metadata in the Data Dictionary)

• Define user requirements of data usage• Monitor use of database• Determine and optimise storage structure and

access strategies• Define authorisation checks• Define strategies for backup and recovery• Define testing procedures and changeover

policy

Page 12: Database Basics

04/07/23 Rajesh.... 12

Classification of DBMS1. Classical DBMS

• Hierarchical

• Network

• Relational

2. New Directions

• Extended Relational

• Object-Oriented

• Distributed

Page 13: Database Basics

04/07/23 Rajesh.... 13

Database Models• Collection of logical constructs used

to represent data structure and relationships within the database– Conceptual models: logical nature of

data representation– Implementation models: emphasis on

how the data are represented in the database

Page 14: Database Basics

04/07/23 Rajesh.... 14

• Relationships in Conceptual Models– One-to-one (1:1)– One-to-many (1:M)– Many-to-many (M:N)

• Implementation Database Models– Hierarchical – Network – Relational

Database Models (con’t.)

Page 15: Database Basics

04/07/23 Rajesh.... 15

Hierarchical Database Model

• Logically represented by an upside down tree– Each parent can have many children– Each child has only one parent

Figure 1.8

Page 16: Database Basics

04/07/23 Rajesh.... 16

Hierarchical Database Model

• Advantages– Conceptual simplicity– Database security and integrity– Data independence– Efficiency

• Disadvantages– Complex implementation– Difficult to manage and lack of standards– Lacks structural independence– Applications programming and use complexity– Implementation limitations

Page 17: Database Basics

04/07/23 Rajesh.... 17

Network Database Model• Each record can have multiple parents

– Composed of sets– Each set has owner record and member record– Member may have several owners

Figure 1.10

Page 18: Database Basics

04/07/23 Rajesh.... 18

Network Database Model• Advantages

– Conceptual simplicity– Handles more relationship types– Data access flexibility– Promotes database integrity– Data independence– Conformance to standards

• Disadvantages– System complexity– Lack of structural independence

Page 19: Database Basics

04/07/23 Rajesh.... 19

Relational Database Model• Perceived by user as a collection of

tables for data storage• Tables are a series of row/column

intersections• Tables related by sharing common

entity characteristic(s)

Page 20: Database Basics

04/07/23 Rajesh.... 20

Relational Database Model (con’t.)

Figure 1.11

Page 21: Database Basics

04/07/23 Rajesh.... 21

Relational Database Model• Advantages

– Structural independence– Improved conceptual simplicity– Easier database design, implementation,

management, and use – Ad hoc query capability with SQL– Powerful database management system

Page 22: Database Basics

04/07/23 Rajesh.... 22

Relational Database Model

• Disadvantages– Substantial hardware and system

software overhead– Poor design and implementation is

made easy– May promote “islands of

information” problems

Page 23: Database Basics

04/07/23 Rajesh.... 23

Object-Oriented Database Model

• Objects or abstractions of real-world entities are stored – Attributes describe properties– Collection of similar objects is a class

• Methods represent real world actions of classes

• Classes are organized in a class hierarchy– Inheritance is ability of object to inherit

attributes and methods of classes above it

Page 24: Database Basics

04/07/23 Rajesh.... 24

THE HIERARCHICAL MODEL

It defines data as and relationships through hierarchy of It defines data as and relationships through hierarchy of data values. This database model is the oldest database data values. This database model is the oldest database

model.model.A DBMS belonging to the hierarchical data model uses A DBMS belonging to the hierarchical data model uses

tree structures to represent relationship among records. tree structures to represent relationship among records. Tree structures occur naturally in many data Tree structures occur naturally in many data

organizations because some entities have an intrinsic organizations because some entities have an intrinsic hierarchical order. For example, an institute has a hierarchical order. For example, an institute has a

number of programmes to offer. Each program has a number of programmes to offer. Each program has a number of courses. Each course has a number of number of courses. Each course has a number of

students registered in it. The following figure depicts, students registered in it. The following figure depicts, the four entity types Institute, Program, Course and the four entity types Institute, Program, Course and

Student make up the four different levels of hierarchical Student make up the four different levels of hierarchical structure. The figure 1 shows an example of database structure. The figure 1 shows an example of database

occurrence for an institute. A database is a collection of occurrence for an institute. A database is a collection of database occurrence.database occurrence.

Page 25: Database Basics

04/07/23 Rajesh.... 25

Figure 1: A simple Hierarchy

• A hierarchical database therefore consists of a collection of records that are connected with each other through links. Each record is a collection of fields (attributes), each of which contains one data value. A link is an association between precisely two records.

Institute

Programme

Courses

Student

Page 26: Database Basics

04/07/23 Rajesh.... 26

• The hierarchical data model has the following features:– Each hierarchical tree can have only one root

record type and this record type does not have a parent record type.

– The root can have any number of child record types and each of which can itself be a root of a hierarchical sub tree.

– Each child record type can have only one parent record type

– Data in a parent record applies to all its children records

– A child record occurrence must have a parent record occurrence; deleting a parent record occurrence requires deleting its entire children record occurrence.

Page 27: Database Basics

04/07/23 Rajesh.... 27

• THE NETWORK MODELThe network data model was formalised in the late 1960s by the Database Task Group of the Conference on Data System Language (DBTG/ CODASYL). Their first report, which has been, revised a number of times, contained detailed specifications for the network data model (a model conforming to these specifications is also known as the DBTG data model). The specifications contained in the report and its subsequent revisions have been subjected to much debate and criticism. Many of the current database applications have been built on commercial DBMS systems using the DBTG model.

Page 28: Database Basics

04/07/23 Rajesh.... 28

The Relational ModelThe relational model is conceptually simple and

more importantly based on mathematical theory of relation. It also frees the users from details of storage structure and access methods.

The relational model like all other models consists of three basic components

A set of domains and a set of relationsOperation on relationsIntegrity rulesCONCEPTS OF A RELATIONAL MODELThe relational model was propounded by E.F. Codd

of the IBM in 1972. The basic concept in the relational model is that of a relation.A relation can be viewed as a table, which has the following properties:

Page 29: Database Basics

04/07/23 Rajesh.... 29

Property 1: it is column homogeneous. In other words, in any given column of a table, all items are of the same kind.Property 2: each item is a simple number or a character

string. That is, a table must be in 1NF. (First Normal Form) which will be introduced in the second unit.

Property 3: all rows of a table are distinct.Property 4: the ordering of rows within a table is immaterial.Property 5: the columns of a table are assigned distinct

names and the ordering of these columns is immaterial.Example of a valid relation

S# P# SCITY10 1 BANGALORE10 2 BANGALORE11 1 BANGALORE11 2 BANGALORE 

Page 30: Database Basics

04/07/23 Rajesh.... 30

THE RELATIONAL COMPLETENESSThe notion of relational completeness was

propounded by Codd in 1972 as a basis for evaluating the power of different query languages.

A language is relationally complete if the basic relational algebra operations can be performed. The basic relational algebra operations are

UnionDifferenceGross productSelection

 

Page 31: Database Basics

04/07/23 Rajesh.... 31

• Object-based models It is a collection of real world objects

called entities and their relationships.It defines the database as a collection of objects and contains both data members/values and operation that are allowed on the data.The interrelationships and constraints are implemented through objects.

Page 32: Database Basics

04/07/23 Rajesh.... 32