Top Banner
Advantages of using a Data Base Controlling Redundancy Restricting Unauthorized users Providing Persistent storage for program objects Providing storage structure Providing Backup and Recovery Multiple User Interfaces Complex Relationships Enforcing Integrity constraints
34

Advantages of using a Data Base

Jan 10, 2016

Download

Documents

vlora

Advantages of using a Data Base. Controlling Redundancy Restricting Unauthorized users Providing Persistent storage for program objects Providing storage structure Providing Backup and Recovery Multiple User Interfaces Complex Relationships Enforcing Integrity constraints. Data Model. - PowerPoint PPT Presentation
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: Advantages of using a Data Base

Advantages of using a Data Base

Controlling Redundancy Restricting Unauthorized users Providing Persistent storage for program objects Providing storage structure Providing Backup and Recovery Multiple User Interfaces Complex Relationships Enforcing Integrity constraints

Page 2: Advantages of using a Data Base

Categories of Data Models

High- level or Conceptual Representational Low-level or Physical

Data Model

Underlying the structure of data base Collection of conceptual tools Defines data, relationships, constraints etc

Page 3: Advantages of using a Data Base

Object Based Logical Model

Entity –Relationship model Object – oriented model Semantic model Functional data model

Hierarchical ModelNetwork Model

Page 4: Advantages of using a Data Base

Schema: The description of the data base Schema diagram: The diagrammatic

representation of the schema Schema Construct: Schema Construct: Each object in the schema Snapshot: Snapshot: The data in a database at a particular

moment of time current set of occurrences current set of instances

Meta-data Meta-data : Storing of description of schema constructs and constraints is called metadata

Page 5: Advantages of using a Data Base

Three Schema Architecture

Internal Schema describes:the physical storage of the databaseuses physical data model,describes the complete details of data storage

Conceptual Schema:Describes the structure of the databaseHides the physical storage structuresDescribes data types, relationships, constraints etc Also known as high level data model

External Schema describes: part of the database that a particular user group is interested in and hides the rest of the database from that user group.

Page 6: Advantages of using a Data Base

Data Independence

Logical Data Independence

Physical Data Independence

Capacity to change the conceptual schema without having to change external schemas or application programs

Changing conceptual schema means: changing constraints, expanding or reducing database etc.

Only view definitions the mappings need to be changed

Capacity to change the internal schema without having to change conceptual schemas

Changing internal schema means: reorganizing physical files, creating access rights etc

Page 7: Advantages of using a Data Base

Data Languages

DDL( Data Definition Language)

Underlying the structure of data base Collection of conceptual tools Defines data, relationships, constraints etc

DSL( Data Storage Language)

VDL( View Definition Language)

DML( Data Manipulation Language)

Specify internal schema

High level or non-procedural DML Low-level or procedural DML

Page 8: Advantages of using a Data Base

DBMS Interfaces

Menu Based Interfaces for web-browsing Forms-based Interfaces Graphical User Interfaces Natural Language Interfaces Interfaces for parametric Users Interfaces for the DBA

Page 9: Advantages of using a Data Base

Data base system environment: DBMS Component modules

Page 10: Advantages of using a Data Base

Data base system Utilities

Loading back-up File – organization Performance monitoring

Page 11: Advantages of using a Data Base

Centralized Architecture for DBMS

Page 12: Advantages of using a Data Base

Two-Tier Client/server architecture

ClientClient ClientClientClientClient

Print Server

Print Server

Print Server

Logical two-tier C/S architecture Physical two-tier C/S architecture

Page 13: Advantages of using a Data Base

Three-Tier Client/server architecture

Logical three-tier C/S architecture

Client

Application ServerOr

Web Server

Data Base Server

Page 14: Advantages of using a Data Base
Page 15: Advantages of using a Data Base

Entities, attributes etc

Entity: An object with physical existence Attribute: A particular property that describes an entity Simple or Atomic attributes: Attributes that are not divisible Composite attributes: Can be divided into smaller sub

parts Composite attributes can form a hierarchy Single valued attribute: An attribute which has a single

value for a particular entity Multi-valued attribute: An attribute which has a more than

one value for a particular entity Stored and derived attribute: age attribute is derived from

birth-date attribute Complex attributes: a structure of many attributes.

Page 16: Advantages of using a Data Base

Entity types, sets, keys, domains

Entity Types: An entity type defines a collection of entities that have the same attributes

Entity set: Collection of all entities of a particular entity type in the database at any point of time is called an entity set

e106100, Josna, III B.Sc

e207101, Minu , IIBSC

e306320,Vianni,IIIBCA

………

E1 Josna, III B.Sc,College hostel

E2Sharal , IIBSC, Outside hostel

E3Nishath, IIIBCA, with Parents

………

Student - entity type Accommodation - entity type

Page 17: Advantages of using a Data Base

key attribute: An attribute whose values are distinct for each individual entity in the entity set

Weak entity type: An entity type which has no key attribute Value sets or Domains: the set of values that may be

assigned to an attribute for each individual entity The value of an attribute A for an entity e is referred to as

A(e) Relationship: An attribute of one entity type referencing to

an attribute of another entity type; Eg: Name of “Accommodation” entity type referencing

name of student entity type

Page 18: Advantages of using a Data Base

A relationship type R among n entity types E1,E2,….En defines a set of associations

Mathematically, the relationship set R is a set of relationship instances ri where each ri associates n individual entities(e1,e2,e3….en)

e1e2e3e4e5e6

e1e2e3e4e5e6

r1r2r3r4r5r6

r1r2r3r4r5r6

d1

d2

d3

d4

d1

d2

d3

d4

Employee Works for Department

Page 19: Advantages of using a Data Base

Degree of relationship: no.of participating entity types. Given an example of relationship with degree 3.(Supplier, Part and project)

Role Names: Signifies the role that a participating entity plays in each relationship

s1s2..

s1s2..

r1r2r3r4r5r6

r1r2r3r4r5r6

j1

j2

j3

j4

j1

j2

j3

j4

SupplierSupply Project

p1p2p3.

p1p2p3.

Part

Page 20: Advantages of using a Data Base

Recursive relationships: The same entity type participates more than once in a relationship in different roles. Such relationship types are called as recursive relationships

e1e2e3e4e5e6

e1e2e3e4e5e6

r1r2r3r4r5r6

r1r2r3r4r5r6

Employee Supervision

Page 21: Advantages of using a Data Base

Cardinality Ratio: Maximum number of relationship instances that an entity can participate in.

1:1 or 1:n or n:1 or m:n

Participation constraint: Specifies whether the existence of an entity depends on its being related to another entity via the relationship type.

Page 22: Advantages of using a Data Base

E-R Diagrams

RRE1E1 E2E2

E1E1 RR E2E2

Entity

Weak Entity

Relationship

Identifying relationship

attribute

Key attribute

Multivalued attribute

Composite attribute

Derived attribute

Page 23: Advantages of using a Data Base
Page 24: Advantages of using a Data Base
Page 25: Advantages of using a Data Base

Relational data model concepts

The relational model represents the database as a collection of collection of relationsrelations

Informally a relation is called as “tabletable” A row is called as a ‘tupletuple’ A column header is called as an ‘attributeattribute’ A ‘Domain‘Domain ‘ D is a set of atomic values for an attribute A ‘relation shemarelation shema’ R is denoted by R(A1,A2,A3….,An) is made up

of relation name R and list of attributes (A1,A2,A3….,An) The degreedegree of a relation is the number of attributes n of its

relation shema n-tuple is an ordered list of n-values t =< v1,v2,v3,….vn) where

each value vi, is an element of domain(Ai) or is a NULL value. A relation state/relation instance relation state/relation instance r of the relation schema

R(A1,A2,A3….,An) is denoted by r(R) and is a set of n-tuples r = {t1,t2,t3,…..tm)

Page 26: Advantages of using a Data Base

Student Relation

STUDENT Name Rollno Address Homephone Age GPA

Asha 1001 Mangalore 12345678 18 8.7

Usha 1002 Kannur 87654321 19 6.7

Nisha 1003 Mubai 87675645 20 8.8

Risha 1004 Delhi 89674534 20 8.9

Disha 1005 Baroda 23445677 18 4.5

Relation Name

AttributesT

uple

s

Page 27: Advantages of using a Data Base

Mathematical definition for “relation”

A relation r( R) is a mathematical relation of degree n on the domains dom(A1), dom(A2),…..dom(An), which is a subset ofThe Cartesian product of domains that define R

))(......)()(()( 21 nAdomAdomAdomRr

The Cartesian product specifies all possible combinations of values from the underlying domains.Cardinality is the total number of values in a domain and it is denoted by |D|.The total number of tuples in the Cartesian product is: |dom(A1)| X |dom(A2)| X ………….. X |dom(An)|

Page 28: Advantages of using a Data Base

Characteristics of relations

Ordering of tuples in a relation( Not predefined but can be done logically)

Ordering of values within a tuple Values and NULLs in a tuple Interpretation of a Relation

Page 29: Advantages of using a Data Base

Constraints

Restrictions imposed on the actual values in a database state

There are three main categories:

Inherent model-based constraints: Constraints that are inherent in the data model

Schema based constraints: Constraints that can be directly expressed in the schemas of the data model that is specifying constraints in DDL

Application based constraints: Constraints that are expressed and enforced by the application programs

Page 30: Advantages of using a Data Base

Domain Constraints

Key Constraints

Domain constraints specify that within each tuple, the value of each attribute A must be an atomic value from a domain dom(A). The data type for an attribute is domain constrain

A relation is defined as a set of tuples All elements of a set are distinct So all tuples in relation must also be distinct It means no two tuples in any relation instance r should have the

same combination of for all their attributes For any two distinct tuples t1 and t2 we have the constraint that:

t1 [Sk] ≠t2[SK] where SK is called as SUPER KEY of the relation schema R.

Super key can have redundant values but a key or primary key value cannot repeat in any tuple.

Page 31: Advantages of using a Data Base

Key

A key satisfies two constraints:1.Two distinct tuples in any state of the relation cannot have identical values for the attributes in the key2. It is minimal superkey- that is a super key from which we cannot remove any attributes and still have the uniqueness constraint hold.

Candidate Key

In general a relation schema may have more than one key. In such cases each of the keys is called as candidate key.One of the candidate keys denoted as primary keyPrimary key is the candidate key whose values are used to identify tuples in a relation

Page 32: Advantages of using a Data Base

Entity Integrity and Referential Integrity Constraints

The entity integrity constrain states that no primary key value can be null

The referential integrity constraint is specified between two relations and is used to maintain the consistency among tuples in two relations

Foreign Key

A set of attributes FK in relation schema R1 is a foreign key of R1 that references relation R2 if it satisfies the following two rules:1.The attributes in FK are said to reference or refer to the relation R2

2.A value of FK in a tuple t1 of the current state r1(R1) either occurs as a value of PK for some tuple t2 in the current state r2(R2) or is null.

Here we have t1[FK]=t2[PK] and we say that tuple t1 references to the tuple t2

Also R1 is referencing relation and R2 is referenced relation

Page 33: Advantages of using a Data Base

Primary Key

Foreign Key

Page 34: Advantages of using a Data Base