Вы находитесь на странице: 1из 63

INTRO TO DBMS

DATA
IT IS A COLLECTION OF FACTS AND FIGURES OVER A PERIOD OF TIME FOR RETRIEVAL AT A LATER DATE.

INFORMATION
IT IS PROCESSED DATA TO SUPPORT CERTAIN DECISION MAKING FUNCTIONS.

DATABASE
A database is any collection of related data

A database is a persistent , logically coherent collection of inherently meaningful data , relevant to some aspect of the real world.

DATABASE MANAGEMENT SYSTEM (DBMS)


Collection of interrelated data Set of programs to access the data DBMS contains information about a particular enterprise DBMS provides an environment that is both convenient and efficient to use. Database Applications:

Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: production, inventory, orders, supply chain Human resources: employee records, salaries, tax deductions

Databases touch all aspects of our lives

PURPOSE OF DATABASE SYSTEM


In

the early days, database applications were built on top of file systems Drawbacks of using file systems to store data:

Data redundancy and inconsistency

Multiple file formats, duplication of information in different files Need to write a new program to carry out each new task

Difficulty in accessing data

Data isolation multiple files and formats Integrity problems


Integrity constraints (e.g. account balance > 0) become part of program code Hard to add new constraints or change existing ones

PURPOSE OF DATABASE SYSTEMS (CONT.)


Drawbacks

of using file systems (cont.)

Atomicity of updates
Failures may leave database in an inconsistent state with partial updates carried out E.g. transfer of funds from one account to another should either complete or not happen at all

Concurrent access by multiple users


Concurrent accessed needed for performance Uncontrolled concurrent accesses can lead to inconsistencies E.g. two people reading a balance and updating it at the same time

Security problems

Database

systems offer solutions to all the above problems

COMPONENTS OF A DATABASE SYSTEM


Data
Hardware Software

Users

COMPONENTS OF A DATABASE SYSTEM

Ranjit

DBMS : A MULTILAYERED SYSTEM

Ranjit

SIMPLIFIED PICTURE OF A DATABASE SYSTEM


COMPONENTS DATA HARDWARE

DBMS DATABASE

SOFTWARE
USERS

APPLICATION PROGRAMS

END USERS

WHAT DOES A DBMS DO


Allow concurrency Control security Maintain data integrity Provide for backup & recovery Control redundancy Allow data independence Provide Non procedural query language Perform automatic query optimisation

WHO INTERACTS WITH A DBMS


System analysts Database designers Database administrators Application developers Users

DATABASE USERS
Application programmers interact with system through DML calls Sophisticated users form requests in a database query language Specialized users write specialized database applications that do not fit into the traditional data processing framework Nave users invoke one of the permanent application programs that have been written previously

E.g. people accessing database over the web, bank tellers, clerical staff

Users are differentiated by the way they expect to interact with the system

TYPES OF DATABASES

Operational databases
Used primarily for OLTP Where need is to collect, modify & maintain data on a daily basis. Dynamic ie changes continuously . Retails stores , manufacturing companies etc

Ranjit

Analytical databases

Primarily used for OLAP To store and track historical & time dependent data Trends , statistics over a long period of time. Rarely modified. Reflects point in time snapshot of data Marketing companies , geological companies etc

Analytical databases often use data from operational databases

WHAT IS A DATA MODEL?


A

notation for describing data or information Description consists of 3 parts:


Structure of the data Operations on the data
Queries Modifications

Constraints on the data

15

DATA MODELS
Data

Model: A set of concepts to describe the structure of a database, and certain constraints that the database should obey.

Data

Model Operations: Operations for specifying database retrievals and updates by referring to the concepts of the data model. Operations on the data model may include basic operations and user-defined operations.

Slide 2-16

HISTORY OF DATA MODELS

Hierarchical Data Model:

Implemented in a joint effort by IBM and North American Rockwell around 1965. Resulted in the IMS family of systems. The most popular model. Other system based on this model: System 2k (SAS inc.) the first one to be implemented by Honeywell in 1964-65 (IDS System). Adopted heavily due to the support by CODASYL (CODASYL - DBTG report of 1971). Later implemented in a large variety of systems - IDMS (Cullinet - now CA), DMS 1100 (Unisys), IMAGE (H.P.), VAX -DBMS (Digital Equipment Corp.). proposed in 1970 by E.F. Codd (IBM), first commercial system in 1981-82. Now in several commercial products (DB2, ORACLE, SQL Server, SYBASE, INFORMIX).

Network Model:

Relational Model:

Slide 2-17

HISTORY OF DATA MODELS

Object-oriented Data Model(s):

Several models have been proposed for implementing in a database system. One set comprises models of persistent O-O Programming Languages such as C++

Object-Relational Models:

Most Recent Trend. Started with Informix Universal Server. Exemplified in the latest versions of Oracle-10i, DB2, and SQL Server etc.

Slide 2-18

THE HIERARCHICAL DATABASE MODEL

Data structured hierarchically as an inverted tree A single table acts as the root of the inverted tree. Other tables act as branches. Relationship is represented by parent/child. Tables are explicitly linked via a pointer or physical arrangement of records in the table. Data is accessed starting from root and continuing down the tree.

ADVANTAGES & DISADVANTAGES HIERARCHICAL MODEL


Data retrieval is quick due to explicit links between the table structures. Referential integrity is inbuilt and automatically enforced. Data can not be entered in child table which is not related to parent. Can not support complex relations. Representing many to many relation requires redundant data. Which may lead to inconsistency. To query this type of data , person must know the complete structure.

THE NETWORK DATABASE MODEL


Addresses some of the problems of hierarchical model. Structure is represented in terms of nodes and set structures. Node represents a collection of records. Set structure represents a relationship relating a pair of nodes together by using one node as an owner and the other node as member. Supports one to many relationship. Record in owner node can exist without having any record in the member node. User can access data from within the network while in Hierarchical data access has to start from the root. Supports complex queries.

THE NETWORK DATABASE MODEL

ONE TO MANY RELATIONSHIP IN NETWORK MODEL

THE RELATIONAL DATABASE MODEL


First conceived in 1969 by Dr Edgar F Codd Based on set theory and first order predicate logic. Stores data in relations known as tables. Each relation is composed of tuples (records) and attributes (Fields) Physical order of records is immaterial. Each record in the table is identified by a field that contains unique value. User need not know the physical structure of the database to retrieve values. Categorises relationships as one to one , one to many and many to many. Data can be retrieved by SQL (structured query language).

THE RELATIONAL DATABASE MODEL

SOME TERMINOLOGY USED IN RELATIONAL MODEL

Relational DB is a collection of tables

Table is a collection of columns (attributes) that describe an entity


Objects are stored as rows (tuples) within a table

Attribute or property is a characteristic or descriptor of an entity

NVSK

FORMAL & INFORMAL MAPPING OF TERMINOLOGY USED IN RELATIONAL MODEL


Formal Relational Term Relation,Entity Informal Equivalents Table

Tuple
Cardinality Attribute Degree Primary Key

Row, Record
No of rows Column, Field No of Columns Unique Identifier

Domain

Set of Legal Values

ADVANTAGES OF RELATIONAL DATABASE

Built in Multilevel Integrity

Field Level Record Level Table Level Primary key

Logical & Physical data independence Data consistency & accuracy Easy data retrieval

RDBMS

A software program which is used to create , maintain , modify and manipulate a relational database.

TERMINOLOGY USED IN RDBMS

TERMINOLOGY IN RDBMS

Used to express & define the special ideas and concepts of RDBMS To express & define the database design process itself. Four Categories

Value related Structure related Relationship related Integrity related

DATA
Values you store in the database. Static till modified

George Edleman

92883

05/16/96

95.00

INFORMATION

Processed data to make it more meaningful

Data is what you store and information is what you retrieve

NULL
Null represents a missing or unknown value. Zero & Blank (Are they Null)

NULL

Any mathematical computation with NULL will always be NULL


(25 x 3) + 4 = 79 (Null x 3) + 4 = Null (25 x Null) + 4 = Null (25 x 3) + Null = Null

EFFECT OF NULL ON OUTPUT

STRUCTURE RELATED TERMS

TABLE

Collection of similar records .

TABLE
Table can represent Object or event Object representation means thins which are tangible like person , place or thing. Object characteristics can be stored in tables. In case table represents an event , it represents something that occurs at a given point in time having characteristics which you wish to store.

VALIDATION TABLE
Also known as look up tables. Generally represents subjects such as city names , skill categories , product codes etc.

FIELD
Fields are the structures that actually store data. It is the smallest structure in the table which represents characteristics of the subject. Contains one and only one value. Types

Multipart (composite field) containing two or more distinct values. Multivalued contains multiple instances of the same type. Calculated field

EXAMPLE : TYPES OF FIELDS

RECORD
Also known as tuple. Represents a unique instance of the subject of a table. Each record is identified by the unique value in the primary key.

VIEW
A view is a virtual table composed of fields from one or more tables in the database. Access refer them as saved queries.

IMPORTANCE OF VIEWS
Allow you to work with data from multiple tables simultaneously ( relationship is must for this purpose) Enable you to prevent certain users from viewing or manipulating data in specific fields within a table. Can be used for data integrity. Such views aare known as data validation views.

KEYS
Keys are special fields that play very specific role within a table. Type of key determines the purpose. Most common : Primary Key & Foreign Key Primary key is a field or group of field that uniquely identifies each record within a table. Primary key which is composed of two or more fields is known as composite primary key. Helpful in enforcing table level data integrity and helps establishing relationships with other tables. Every table must have a primary key.

PRIMARY & FOREIGN KEY

INDEX

An index is a structure RDBMS provides to improve data processing. Can be based on any type of field. Basically reorganization of records based on certain field or set of fields.

RELATIONSHIP RELATED TERMS

RELATIONSHIP
A relationship exists between two tables if records of one table cane associated with records of the other table. Enables to create multiple views. Helps reduce redundant data and eliminate duplicate data. Relationship can be established via a set of primary and foreign keys. Relationship can also be established through a third table which is known as linking table or associate table.

RELATIONSHIP VIA PRIMARY & FOREIGN KEYS

RELATIONSHIP VIA AN ASSOCIATE TABLE

TYPES OF RELATIONSHIPS
One to One Relationship One to Many Relationship Many to many Relationship

ONE TO ONE RELATIONSHIP

One table serves as a parent and the other as a child Here both tables share the same primary key

ONE TO MANY RELATIONSHIP

Relationship is established by primary & foreign keys One record in parent relates to many records in the child while single record in the child can be related to only one record in the parent

MANY TO MANY RELATIONSHIP

Unresolved many to many relationship How to relate these tables : No field seems to be common

MANY TO MANY RELATIONSHIP

Linking table is used to establish such relationship Linking table is formed by taking the primary keys of both tables and forming a new table.

PARTICIPATION IN A RELATIONSHIP

Type of Participation

Compulsory or Optional

Whether a record in the table A can exist without having a corresponding record in the table B

Degree of Participation

Degree of participation is established between table A & table B by indicating a minimum & maximum no of records in table B that can be linked to a single record in A. Example if child table can have a maximum of 10 and at least one record linked to parent then degree of participation id written as 1,10.

INTEGRITY RELATED TERMS

FIELD SPECIFICATION

A field specification (domain) represents all the elements of a field. Each field specification has three types of elements

General, Physical , Logical

General

field name , description , parent table


Data type , Length , & Display format Required value , range of Values , & Default Value

Physical :

Logical

DATA INTEGRITY

Refers to validity , consistency database . Four types.

and accuracy of the

Table level integrity , Field level , Relationship level , Business rule level No duplicate records and field that identifies each record unique & never NULL. Valid , consistent & accurate values in each field.

Table Level ( Entity Integrity)

Field Level ( Domain Integrity)

Relationship Level ( Referential Integrity)

Ensures records in the table are synchronised whenever insert , modify & delete operations are performed
Depending upon business rules data base design may change which also includes integrity constraints..

Business Related

NVSK

Вам также может понравиться