Top Banner

of 33

Database Management Unit-I

Jun 04, 2018

Download

Documents

Rahul Kumar K
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
  • 8/13/2019 Database Management Unit-I

    1/33

    UNIT

    I

    Introduction to Database Systems

    DATABASE MANAGEMENT SYSTEMS

  • 8/13/2019 Database Management Unit-I

    2/33

    Terminology

    Data = known facts that can be recorded

    Database (DB) = logically coherent collection of related data with some inherent

    meaning

    Entities such as students, courses, sections

    Relationships between entities such as students taking courses and sections

    being part of courses

    Database management system (DBMS) = collection of programs that enable

    users to create and maintain a DB; general-purpose software system that

    facilitates process of defining, constructing, and manipulatingDBs for various

    applications.

  • 8/13/2019 Database Management Unit-I

    3/33

    A shared collection of logically related data and a description of this

    data, designed to meet the information needs of an organization

    Data repository (data resource)

    Designed independently of applications (i.e., data abstraction)

    Long-term information needs at the enterprise level

    Primarily designed for quick and efficient data retrieval

    What is database?

  • 8/13/2019 Database Management Unit-I

    4/33

    What the Purpose for Learning about Database?

    Paradigm shift: Data driven business environment

    Customer information (e.g.,

    database marketing, CRM)

    Competitor andmarketplace information

    Production efficienciesKnowledge and innovation

    (e.g., knowledge

    management, businessintelligence)

    Coordination of vendors (e.g.,supply chain management

  • 8/13/2019 Database Management Unit-I

    5/33

    History (1)

    Early 60s

    Charles Bachman introduced first general purpose DBMS known as IDS (TuringAward 1973) at General Electric (GE)

    Integrated Data Store (IDS) formed the basis for N/w data model

    Network Data Model was standardized by the Conference on Data SystemsLanguages (CODASYL).

    Late 60s

    IBM developed IMS

    Information Management Systems (IMS) formed basis for Hierarchical DataModel

    Hierarchichal Data Model

    SABRE system for making airline reservation jointly by IBM and American

    Airlines (allowed several people to access the same data thro computer N/W) 70s

    Edgar Codd, at IBM proposed Relational Data Model (Turing Award 1981)

    Use of DBMSs for managing corporate data became standard practice

  • 8/13/2019 Database Management Unit-I

    6/33

    History (2)

    80s

    Relational Data Model became dominant DBMS paradigm

    SQL query language for relational DBs developed as part of IBMs System R

    projectis now the standard query language

    Transaction Management (concurrent execution of db programs) (James Gray,

    Turing Award 1999)

    Now Object-oriented Data Model

    Data warehouse and data mining

    Accessing databases through the web/internet

    Multimedia data

    Text data (information retrieval)

    Structure of the data (XML)

  • 8/13/2019 Database Management Unit-I

    7/33

    Traditional File-Based System

    Definition:

    "A collection of application programs that perform services for the end-userssuch as the production of reports. Each program defines and manages its

    own data."

    PayrollOperating

    expenses

    Customer

    transactionsVendorsInventory

    Program Program Program Program Program

    Report Report Report Report Report

    One fi le, one application

  • 8/13/2019 Database Management Unit-I

    8/33

    Data Redundancy

    Customer Order File

    Invoice number

    Customer account number

    Customer name, address, city, state, zip code

    Order date

    Product code, product description, price, unit

    Customer Account File

    Account Number

    Customer name, mailing address, city, state, zip code

    Customer Mailing List File

    Customer name, mailing address, city, state, zip code

  • 8/13/2019 Database Management Unit-I

    9/33

    File-Based Systems

    Records contain logically related data

    Limitations:

    Separation and isolation of data (one file, one program)

    Duplication of data Loss of data integrity - uncertainty of the correctversion of data and no

    consistency

    Data dependence - application program defines the data

    Incompatibility of file formats

    Fixed queries/proliferation of application programs - little flexibility inmeeting changing information needs

  • 8/13/2019 Database Management Unit-I

    10/33

    Database

    Data and

    DataDefinitions

    Applications

    A shared collection of logically related data (and a description of this

    data), designed to meet the information needs of an organization.

    SeparationCentral Repository

  • 8/13/2019 Database Management Unit-I

    11/33

    Data Abstraction

    Separation between the datas structure (definition) and the application

    programs

    Data andData

    Definitions

    Applications

    CentralRepository

    DBMS

    Application programs can be runon either the clients or server

  • 8/13/2019 Database Management Unit-I

    12/33

    Organizing Data

    Entity - distinct object (i.e., person, place, thing, concept or event)

    Attribute - describes some aspect of the entity (object)

    Property of the entity

    Relationship - association between entities

    Customers

    Account_number

    NameAddress

    Purchases

    Invoice_number

    Account_numberPurchase_date

    Attributes

    Relationship

    Entity Entity

  • 8/13/2019 Database Management Unit-I

    13/33

    Database

    Customer

    OrdersOrder Items

    Manufacturers

    Products

    DBMS

    Management

    Queries

    ApplicationPrograms

    Other

    Software

    DDL

    DML

    Controlled accessCentral Repository

    (Organizational resource) Single Access Point Multitude of

    Applications

  • 8/13/2019 Database Management Unit-I

    14/33

    Advantages of the Database Approach

    Control of data redundancy

    Data consistency

    Efficient data access, Greater informational gain, more information from the

    same amount of data

    Sharing data, organizational resource (i.e., shared resource)

    Improved data integrity, validity and consistency

    Improved access and security

    Enforcement of standards

    Concurrency Access and Crash recovery

    Data Administration

    Reduced Application development time

  • 8/13/2019 Database Management Unit-I

    15/33

    Database Applications

    Traditional database applications (banks, library catalogs, inventory, airlines,

    universities)

    Multimedia databases (images)

    Geographic information systems

    Data warehouse and online analytical processing (OLAP)

    Real time and active database technology (sensor systems, safety-critical

    systems)

    World wide web (e-commerce, internet banking)

  • 8/13/2019 Database Management Unit-I

    16/33

    DBMS Available

    ORACLE

    DB2by the IBM

    MS-SQL

    Teradata

    Sybase

    Informix

  • 8/13/2019 Database Management Unit-I

    17/33

    Data Model

    Collection of high level data description constructs that hide many low-levelstorage details

    Semantic data model

    More abstract, high level data model (makes it easier to describe about the data)

    Widely used one is ER modelpictorially denotes entities and relationshipsamong them

    Relational Model Relationset of records

    Schema

    A description of data in terms of a data model is schema

    Schema for a relation specifies its name, name of each field (or attribute or

    column) and type of each field. Example

    Students(sid: string, name: string, login: string, gpa: real)

    Each row in the relation is a record that describes the student

  • 8/13/2019 Database Management Unit-I

    18/33

    Other Data Models

    Relational Data model ( dominant model)

    Hierarchical data model

    Network model

    Objectoriented model

    Objectrelational model

  • 8/13/2019 Database Management Unit-I

    19/33

    Types of Database Models

    HIERARCHICAL

    RELATIONAL

    TABLEROW

    COLUMN

    VALUE

  • 8/13/2019 Database Management Unit-I

    20/33

    Database Architecture/ Levels of Data Abstractions

    Internal level

    (storage view)

    Conceptual level(community user view)

    External level(individual user

    views)

    Database

  • 8/13/2019 Database Management Unit-I

    21/33

    Conceptual Schema

    Describes data in terms of the data model of the DBMS.

    In a RDBMs, the conceptual schema describes all relations that are stored in the

    database. Eg. University Db

    Students (sid: string, name: string, gpa: real)

    Faculty (fid: string, fname: string, sal: real)

    Physical schema Specifies additional storage details

    Summarizes how the relations described in conceptual schema are actually stored

    on secondary storage devices like disks and tapes

    Decide on what file organizations to use to store relations and indexes to speed

    up data retrieval operations

    External Schema

    Allow data access to be customized at the level of individual users or groups of

    users.

  • 8/13/2019 Database Management Unit-I

    22/33

    An Example of the Three Levels

    SNo FName LName Age Salary

    SNo FName LName Age Salary

    SNo LName BranchNo

    struct STAFF {

    int staffNo;

    int branchNo;

    char fName[15];char lName[15];

    struct date dateOfBirth;

    float salary;

    struct STAFF *next;

    /* pointer to next Staff record

    */};

    index staffNo; index branchNo;

    /* define indexes for staff */

    BranchNo

    Conceptual View

    External View1

    Internal View

    External View2

  • 8/13/2019 Database Management Unit-I

    23/33

    Database Design Phases

    DATA ANALYSIS

    Entities - Attributes - Relationships - Integrity Rules

    LOGICAL DESIGN

    Tables - Columns - Primary Keys - Foreign Keys

    PHYSICAL DESIGN

    DDL for Tablespaces, Tables, Indexes

  • 8/13/2019 Database Management Unit-I

    24/33

    Data Independence

    Ability to change one schema level without affecting the higher levelschemas

    Physical Data Independence

    Ability to change physical schema or internal schema without affecting

    conceptual or logical schema

    Logical Data Independence

    Ability to change logical schema without affecting External or view schema.

    (application programs)

    One imp. Adv of DBMS is data independence

  • 8/13/2019 Database Management Unit-I

    25/33

    Characteristics of the DB approach (1)

    Single repository of data defined once, maintained and accessed by users

    Self-describing nature of DB

    DB + description of DB structures and constraints

    stored in primary DB metadata (stored in catalog)

    DBMS software works with any number of DB applications

    Insulation between programs and data, and data abstraction

    Program--data independence Program--operation independence (OO DBMS)

    Abstraction: conceptual representation of data, no details of how data is stored

    or operators are implemented

  • 8/13/2019 Database Management Unit-I

    26/33

    Characteristics of the DB approach (2)

    Data model

    Relational data model

    Object-oriented data model

    Entity-relationship data model

    Support multiple views of data

    view = subset of DB

    virtual data derived from DB (not explicitly stored)

    Sharing data and multi-user transaction processing

    Concurrency control

    Online transaction processing (OLTP)

  • 8/13/2019 Database Management Unit-I

    27/33

    Query Languages

    Query questions involving data stored in dbms

    Relational Algebra

    formal query language based on collection of operators for manipulating

    relations

    Relational Calculus

    formal query language based on mathematical logic

    DDL: Data Definition Language

    Defines db structure

    Commands used are for creating, altering, query data

    DML: Data Manipulation Language For manipulating (inserting, deleting, updating) db contents

    Procedural and Nonprocedural (Declarative) DML

  • 8/13/2019 Database Management Unit-I

    28/33

    Types of DML

    Procedural DML Must be embedded in a programming language. Searches for and retrieves

    individual db records and uses looping and other constructs of the host

    programming language to retrieve multiple records

    Non-Procedural or Declarative DML Can be used as a stand-alone query language or can be embedded in a

    programming language. Searches for and retrieves information from

    multiple related db records in a single command

  • 8/13/2019 Database Management Unit-I

    29/33

    Components of a Database Environment

    Hardware

    Software: DBMS, application program and query software

    Data: Organized in a schema, partitioned into subschemas

    Procedures: Govern the design, access and use of the database

    People: Administrators (DA, DBA), designers (logical and physical),

    application developers and users (novice and high-powered)

  • 8/13/2019 Database Management Unit-I

    30/33

    Database System

    Stored Data Defn.Stored Database

    Software to access stored data

    Software to process queries/programs

    DBMS

    Software

    Application Programs/Queries

    Users

    DATABASE

    SYSTEM

    (META-DATA).

  • 8/13/2019 Database Management Unit-I

    31/33

    Users of the Database

    Day-to-day use of the DB

    Database administrators (DBA)

    Database designers

    End-users

    Casual end-users

    Nave or parametric users

    Sophisticated end-users

    Stand-alone users

    System analysts and application programmers (software engineering)

  • 8/13/2019 Database Management Unit-I

    32/33

    Implications of the DB approach

    Potential for enforcing standard

    Reduce application development time

    Flexibility

    Availability of up-to-date info

  • 8/13/2019 Database Management Unit-I

    33/33

    When not to use a DBMS

    Unnecessary overhead costs Security, concurrency control, recovery and integrity

    High initial investment in hardware, software, training

    DB and applications are simple, well defined, not expected to change

    Real-time requirements not met (due to overhead)

    Multi-user access not required