dbms unit 1 ppts

Upload: hema-vathy

Post on 07-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Dbms Unit 1 Ppts

    1/25

    UNIT I:

    INTRODUCTION

  • 8/6/2019 Dbms Unit 1 Ppts

    2/25

    UNIT 1: Introduction

    Data Vs Information Database Management System(DBMS)

    Database System Applications Purpose of Database Systems View of Data

    Data-Models

  • 8/6/2019 Dbms Unit 1 Ppts

    3/25

    DATA

    Vs

    INFORMATION

  • 8/6/2019 Dbms Unit 1 Ppts

    4/25

    Database Management System (DBMS)

    DBMS contains information about a particular

    enterprise

    Collection of interrelated data Set of programs to access the data

    An environment that is both convenient

    and efficientto use

  • 8/6/2019 Dbms Unit 1 Ppts

    5/25

    Database Applications:

    Banking: all transactions

    Airlines: reservations, schedules

    Universities: registration, grades

    Sales: customers, products, purchases

    Online retailers: order tracking, customizedrecommendations

    Manufacturing: production, inventory, orders, supplychain

    Human resources: employee records, salaries, taxdeductions

    Databases touch all aspects of our lives

  • 8/6/2019 Dbms Unit 1 Ppts

    6/25

    Purpose of Database Systems

    In the early days, database applications were built directly on top of file

    systems

    Drawbacks of using file systems to store data:

    Data redundancy and inconsistency

    Multiple file formats, duplication of information in differentfiles

    Difficulty in accessing data

    Need to write a new program to carry out each new task

    Data isolation multiple files and formats

    Integrity problems Integrity constraints (e.g. account balance > 0) become

    buried in program code rather than being stated explicitly

    Hard to add new constraints or change existing ones

  • 8/6/2019 Dbms Unit 1 Ppts

    7/25

    Purpose of Database Systems (Cont.)

    Drawbacks of using file systems (cont.)

    Atomicity of updates

    Failures may leave database in an inconsistent state with partialupdates carried out

    Example: Transfer of funds from one account to another should eithercomplete or not happen at all

    Concurrent access by multiple users

    Concurrent accessed needed for performance

    Uncontrolled concurrent accesses can lead to inconsistencies

    Example: Two people reading a balance and updating it at the

    same time Security problems

    Hard to provide user access to some, but not all, data

    Database systems offer solutions to all the above problems

  • 8/6/2019 Dbms Unit 1 Ppts

    8/25

    Levels of Abstraction

    Physical level: describes how a record (e.g., customer) is stored.

    Logical level: describes data stored in database, and the

    relationships among the data.

    type customer=record

    customer_id: string;

    customer_name : string;

    customer_street: string;

    customer_city: string;

    end;

    View level: application programs hide details ofdata types.

    Views can also hide information (such as an employees salary)

    for security purposes.

  • 8/6/2019 Dbms Unit 1 Ppts

    9/25

    View of DataAn architecture for a database system

  • 8/6/2019 Dbms Unit 1 Ppts

    10/25

    Instances and Schemas Schema the logical structure of the database

    Example: The database consists of information about a set of customers

    and accounts and the relationship between them)

    Analogous to type information of a variable in a program

    Physical schema: database design at the physical level

    Logical schema: database design at the logical level

    Instance the actual content of the database at a particular point in time

    Analogous to the value of a variable

    Physical Data Independence the ability to modify the physical schema

    without changing the logical schema

    Applications depend on the logical schema

    In general, the interfaces between the various levels and components

    should be well defined so that changes in some parts do not seriously

    influence others.

  • 8/6/2019 Dbms Unit 1 Ppts

    11/25

    Data Models

    A collection of tools for describing

    Data

    Data relationships

    Data semantics

    Data constraints

    Relational model

    Entity-Relationship data model (mainly for database design)

    Object-based data models (Object-oriented and Object-relational)

    Semi-structured data model (XML) Other older models:

    Network model Hierarchical model

  • 8/6/2019 Dbms Unit 1 Ppts

    12/25

    Data Manipulation Language (DML)

    Language for accessing and manipulating the data organized by the appropriate

    data model

    DML also known as query language

    Two classes of languages

    Procedural user specifies what data is required and how to get those data Declarative (nonprocedural) user specifies what data is required without

    specifying how to get those data

    SQL is the most widely used query language

  • 8/6/2019 Dbms Unit 1 Ppts

    13/25

    Data Definition Language (DDL)

    Specification notation for defining the database schema

    Example: create table account(account_number char(10),

    branch_name char(10),

    balance integer)

    DDL compiler generates a set of tables stored in a data dictionary

    Datad

    ictionary contains metad

    ata (i.e.,d

    ata aboutd

    ata) Database schema

    Data storage and definition language

    Specifies the storage structure and access methods used

    Integrity constraints

    Domain constraints

    Referential integrity (e.g. branch_name must correspond to a validbranch in the branch table)

    Authorization

  • 8/6/2019 Dbms Unit 1 Ppts

    14/25

    Database Application Architectures

    (web browser)

    Old Modern

  • 8/6/2019 Dbms Unit 1 Ppts

    15/25

    Database Users

    Users are differentiated by the way they expect to interact with

    the system

    Nave users invoke one of the permanent application programs that have been

    written previously Examples, people accessing database over the web, bank tellers, clerical staff

    Application programmers interact with system through DML calls

    Sophisticated users form requests in a database query language

    Specialized users write specializeddatabase applications that do not fit into the

    traditional data processing framework

  • 8/6/2019 Dbms Unit 1 Ppts

    16/25

    Database Administrator

    Coordinates all the activities of the database system

    has a good understanding of the enterprises information resources and

    needs.

    Database administrator's duties include:

    Storage structure and access methoddefinition

    Schema and physical organization modification

    Granting users authority to access the database

    Backing up data

    Monitoring performance and responding to changes

    Database tuning

  • 8/6/2019 Dbms Unit 1 Ppts

    17/25

    The Entity-Relationship Model

    Models an enterprise as a collection ofentities andrelationships

    Entity: a thing or object in the enterprise that is distinguishable from

    other objects

    Described by a set ofattributes

    Relationship: an association among several entities Representeddiagrammatically by an entity-relationship diagram:

  • 8/6/2019 Dbms Unit 1 Ppts

    18/25

    Entity-Relationship (E-R)

    The entity-relationship data model

    perceives the real world that consistsof a set of basic objects entities and

    a relationships among the objects.

  • 8/6/2019 Dbms Unit 1 Ppts

    19/25

    Entity and Entity set

    An entity is an object that exists in

    the real world and is distinguishable

    from other objects.

    The collection of all entities of the

    same type is an entity set.

  • 8/6/2019 Dbms Unit 1 Ppts

    20/25

    NOTATION FOR ER DIAGRAM

    Meaning

    ENTITY TYPE

    WEAK ENTITY TYPE

    RELATIONSHIP TYPE

    IDENTIFYING RELATIONSHIP TYPE

    ATTRIBUTE

    KEY ATTRIBUTE

    MULTIVALUED ATTRIBUTE

    COMPOSITE ATTRIBUTE

    DERIVED ATTRIBUTE

    TOTAL PARTICIPATION OF E2 IN R

    CARDINALITY RATIO 1:N FOR E1:E2 IN R

    STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R

    Symbol

    E1 R E2

    E1 R E2

    R(min,max)

    E

    N

  • 8/6/2019 Dbms Unit 1 Ppts

    21/25

    The Entity-Relationship Model

    Models an enterprise as a collection ofentities andrelationships

    Entity: a thing or object in the enterprise that is distinguishable from

    other objects

    Described by a set ofattributes

    Relationship:an association among several entities

    Representeddiagrammatically by an entity-relationship diagram:

  • 8/6/2019 Dbms Unit 1 Ppts

    22/25

    FIGURE :An ER diagram for a BANK database schema.

  • 8/6/2019 Dbms Unit 1 Ppts

    23/25

    Do it yourself..

    Question:

    Construct a ER diagram to show a depositor

    relationship that associates a customer witheach account that he has.

  • 8/6/2019 Dbms Unit 1 Ppts

    24/25

    Slide 3-24

    An ER schema diagram for the COMPANY database.

  • 8/6/2019 Dbms Unit 1 Ppts

    25/25

    Slide 3-25

    FIGURE : An ER diagram for an AIRLINE database schema