Database and RDBMS Concepts Session 1

download Database and RDBMS Concepts Session 1

of 42

Transcript of Database and RDBMS Concepts Session 1

  • 8/12/2019 Database and RDBMS Concepts Session 1

    1/42

  • 8/12/2019 Database and RDBMS Concepts Session 1

    2/42

    Objectives

    File Processing System

    Data Base Management System

    Different types of DBMS

  • 8/12/2019 Database and RDBMS Concepts Session 1

    3/42

    Data Vs Information

    What is data? facts concerning things such as people, objects,

    events, etc.

    EX : Marks 80 %, 75 %, 65 %, 99%

    What is information? data that has been processed and presented in a

    form suitable for human interpretation.

    Ex : Marks of a Student No. 1998 is 80% inRDBMS course.

  • 8/12/2019 Database and RDBMS Concepts Session 1

    4/42

    Data Vs Information

    To derive information from data weneed to Store and Process.

    Need systems support to easily

    Store

    Retrieve

    and Modify data

  • 8/12/2019 Database and RDBMS Concepts Session 1

    5/42

    Traditional Method of Storage

    Files

    File Management System (O/S)

    Application

    ProgramsP1 P2 P3 P4

    001 Chandu Enr

    002 Steve Pdn

    003 Hema Enr

  • 8/12/2019 Database and RDBMS Concepts Session 1

    6/42

    Files in an Organization

    Data File

    Master files

    Transaction files

    Others

    Computer program files Backup files

    Specialized files: Index files & log files.

    Other important files

    Object File

    Library File Executable File / Load Module

    Temporary Files

    What is the significance of each type of file ?

  • 8/12/2019 Database and RDBMS Concepts Session 1

    7/42

    Ways of storing data in Files4176 Aniruddha Sarkar CAPS

    4181 Manoj Saha WENA

    4183 Moushumi Dharchoudhury CENA

    4203 Suryanarayana D.V.S.S. SONA

    4204 Vivek Rai CAPS

    4176 AniruddhaSarkar CAPS

    4181 ManojSaha WENA

    4183 MoushumiDharchoudhury CENA

    4203 SuryanarayanaD.V.S. SONA

    4204 VivekRai CAPS

    4176,Aniruddha Sarkar,CAPS,4181,Manoj Saha,WENA,4183,Moushumi

    Dharchoudhury,CENA,4203,Suryanarayana D.V.S.,SONA,4204,Vivek Rai,CAPS

    Predefined length

    Uses space/commas as character

    separators

  • 8/12/2019 Database and RDBMS Concepts Session 1

    8/42

    DATADEPENDENCY

    INCONSISTENCY

    REDUNDANCY

    LOSS OF

    FLEXIBILITY

    MULTIPLE

    FILES

    UPDATE

    PROBLEM

    Problems with File approach

  • 8/12/2019 Database and RDBMS Concepts Session 1

    9/42

    Introduction To

    Data Base ManagementSystem?

  • 8/12/2019 Database and RDBMS Concepts Session 1

    10/42

    Introduction to DatabaseManagement Systems

    The most traditional/common way of managing data is to store them infiles.

    File processing system

    Files can be

    Sequential

    Indexed

    Relative

    In this kind of scenario, the files are managed directly by the operatingsystem services

    The primary focus here is to manage the files effectively rather thanthe contents of them

    Though this mechanism is very good, it has many draw backs

  • 8/12/2019 Database and RDBMS Concepts Session 1

    11/42

    What are the problems in FileProcessing

    File processing system manages files rather than the data in them.

    How does it affect me ?

    File Processing System does not provide effective security

    Either the entire file is secured or it is not

    Some part of the file cannot be secured

    record or column level security is not available

    Any program which works with files has to know the physical as well asthe logical structure of the file

    Any change in either physical or logical structure of the file, makesit necessary for the program to be rewritten

    Physical Data Dependence

    Logical Data Dependence

  • 8/12/2019 Database and RDBMS Concepts Session 1

    12/42

    Introduction to DBMS

    Data Base Management System

    A DBMS is a special set of software which is usedto manage data (information)

    Following are some of the important functionsof a DBMS

    Data is Accurate (Accuracy)

    Data is provided within a timeframe (Timeliness) Only required data is provided (Relevancy)

  • 8/12/2019 Database and RDBMS Concepts Session 1

    13/42

    The Database

    Database is a set of inter-related data

    stored centrally on any online mediumwith controlled redundancy which canbe shared by multiple application /

    users with a practical ease.

  • 8/12/2019 Database and RDBMS Concepts Session 1

    14/42

    A database is a repository of integrated &

    shared data

    The Database

    Computer based record-keeping system

    Collection of interrelated (persistent)

    dataRecords & maintains data

    Represents real world objects

  • 8/12/2019 Database and RDBMS Concepts Session 1

    15/42

    DBMS and File ProcessingSystem

    A database is a collection of data

    All the information is available centrally

    A file is a collection of bits and piecesstored together as a single entity.

    A database system internally relies on the

    file processing system to manage its data Externally to the user, he feels that he is

    storing data, rather than a file

  • 8/12/2019 Database and RDBMS Concepts Session 1

    16/42

    Advantages of Database

    Redundancy can be reduced

    Inconsistency can be avoided

    Sharing of DataStandards can be enforced

    Security restrictions can be applied

    Integrity of data can be maintainedConflicting requirements can be balanced

  • 8/12/2019 Database and RDBMS Concepts Session 1

    17/42

    Database ManagementSystem

    Interface between user & DB

    Constructs, expands & maintains the DB

    File creation / deletion

    Adding, deleting & modifying records

    Selecting records (queries)

    Manages one or more databasesHigher level of abstraction

  • 8/12/2019 Database and RDBMS Concepts Session 1

    18/42

    Application Programs usingDBMS Services

    Application

    Programs

    DBMS

    File System

    Storage

    A1 A2 A3

  • 8/12/2019 Database and RDBMS Concepts Session 1

    19/42

    App. pgmmer

    Interface thro High

    level language

    OS (File Mgr, Disk Mgr)

    End userApp. pgmmer

    Interface thruQuery

    OS (File Mgr, Disk Mgr)

    DBMS

    Where does DBMS fit ?

    End user End user

    Physical Storage

    (Hardware)

    Physical Storage

    (Hardware)

  • 8/12/2019 Database and RDBMS Concepts Session 1

    20/42

    DBMS Architecture

    Conceptual level

    Internal level

    External

    View

    External

    View

    External

    View

    DBMS interface

    DBMS interface

    DISK(s)

  • 8/12/2019 Database and RDBMS Concepts Session 1

    21/42

    Emp. Name

    Emp. Address

    Emp. NameEmp. SSNEmp. AddressEmp. Annual_Salary

    Emp. Name : string(25)Emp. SSN : Integer, Primary key

    Emp. Address : string(50)Emp. Skill : String(6)Emp. Annual_Salary : Dec(9,2)

    Name : string, length 25, offset 0SSN : Integer, length 4, offset 25,

    INDX unique indexAddress : string, length 50, offset 29Skill : String, length 6, offset 79Annual_Salary : dec (9,2),length 5, offset 85

    External

    view

    Conceptual view

    Internal view

    User1

    User2

    DBA

  • 8/12/2019 Database and RDBMS Concepts Session 1

    22/42

    Interaction with DBMS

    A user issues an access request using someparticular sub-language (typically SQL)

    The DBMS intercepts the request & interpretsit

    The DBMS inspects, in turn, the externalschema, the external/conceptual mapping,the conceptual schema, theconceptual/internal mapping & storagestructure definition

    The DBMS performs the necessary operationson the stored DB

  • 8/12/2019 Database and RDBMS Concepts Session 1

    23/42

    Data sub-languageGenerally data sub-language (DSL) is embeddedin a host language like C or COBOL

    Data Definition Language (DDL) :defines & describes the DB objects

    Data Manipulation Language (DML) :

    supports the manipulation or processingsuch objects

  • 8/12/2019 Database and RDBMS Concepts Session 1

    24/42

    Users of a DBMS

    Database Administrator(DBA)

    Database Designer

    Application Programmer & SystemAnalyst

    End users

  • 8/12/2019 Database and RDBMS Concepts Session 1

    25/42

    Characteristics of DBMS

    Data independence

    Speedy handling of spontaneous

    information requestsNon-Redundancy

    Versatility in representing relationships

    between data itemsSecurity protection

    Real Time accessibility

    f d ff

  • 8/12/2019 Database and RDBMS Concepts Session 1

    26/42

    Comparison of differentsystems

    For better understanding we have broken the different types of data processingsystems into the following four categories

    Rudimentary I/O software

    Programs working with flat files

    COBOL or C language

    File Storage with Access Method

    Programs working with file managers like VSAM or ISAM or Btrieve

    COBOL or C Language

    Database Management System

    Programs written in COBOL or C or Java to work with RDBMS like DB2,Oracle or Sybase

    Programs written in COBOL or RPG to work with Hierarchical andNetwork DBMS

    Lot of efforts in generating reports

    Advanced Management Tools

    Use of Rapid Application Development Tools like Report Generator orForms Generator for creating large applications

    C i f iff

  • 8/12/2019 Database and RDBMS Concepts Session 1

    27/42

    Comparison of DifferentSystems

    Rudimentary I/OSoftware

    File Storage with Accessmethod

    Database Management Advanced ManagementSystems

    No independence Storage Independence Physical DataIndependence

    Logical Data Independence

    Applicationprogrammer designsthe physical data

    layout and embeds itinto his program

    Storage units can bechanged withoutchanging program

    Physical data structurecan be changed withoutchanging programs

    Global logical data bechanged without changingthe program

    Applicationprogrammers view ofthe file is same as thephysical structure

    Applicationprogrammers view ofthe file is converted intophysical file by thesoftware

    Physical databasestructures are completelyseparated from thelogical structures

    Schema, subschema andphysical data is absolutelyseparate

    Programmer usessimple files

    Application programmermore concerned withstructures andaddressing

    Application programmermore concerned withstructures andaddressing

    Application programs arecompletely insulated fromthe data structures

  • 8/12/2019 Database and RDBMS Concepts Session 1

    28/42

    Comparison of Different SystemsRudimentary I/O

    Software

    File Storage with

    Access method

    Database

    Management

    Advanced

    ManagementSystems

    Entirelysequential files

    Sequential fileswith some directaccess

    Direct access filesfor someapplications

    Direct access to alllive data

    Data accessed

    with primary key

    Data accessed

    with primary aswell as secondarykeys

    Generalized

    searching facility

    Generalized

    searching facility

    No attention todata security

    Securityproceduresapplied to

    individual datafiles

    Securityprocedures appliedto individual data

    files

    Corporate worldwide security

    No teleprocessing

    Simple remoteinquiry

    Remote data entryand inquiry

    Complete interactiveprocessing remotely.Computer networksand distributeddatabases

  • 8/12/2019 Database and RDBMS Concepts Session 1

    29/42

    Different types of DBMS

  • 8/12/2019 Database and RDBMS Concepts Session 1

    30/42

    Hierarchical ModelP1 Nut Red 12 London

    S1 Jones 10 Paris 300

    S2 Smith 20 London 300

    P2 Bolt Green 17 Paris

    S1 Jones 10 Paris 300

    S2 Smith 20 London 400

    S3 Blake 10 Paris 200

    P3 Screw Blue 12 London

    S1 Jones 10 Paris 300

    P4 Screw Green 17 Paris

  • 8/12/2019 Database and RDBMS Concepts Session 1

    31/42

    Hierarchical Model

    In a hierarchical model a tree likestructure is maintained

    For each parent record, there can bemany siblings

    The record at the top is called the root

    The root may have any number ofdependants. Each of which may havelower level dependants.

    D b k f Hi hi l

  • 8/12/2019 Database and RDBMS Concepts Session 1

    32/42

    Drawbacks of Hierarchicalmodel

    Insert It is not possible to insert a supplier who is not

    supplying a part currently

    Delete Deleting part information will also delete

    information about all the suppliers below it

    Update If you need to update any supplier information,

    you need to search the entire database for thesame supplier and update all the records for thesame supplier.

  • 8/12/2019 Database and RDBMS Concepts Session 1

    33/42

    Network Model

    S1 Smith 20 London S2 Jones 10 Paris S3 Blake 10 Paris

    P1 Nut Red 12 London P2 Bolt Green 17 Paris P3 Screw Red 12 Rome P4 Screw Green 10 Paris

    300200 500 100

    300

  • 8/12/2019 Database and RDBMS Concepts Session 1

    34/42

    Network Model

    In case of network model, data isrepresented by records and links

    Many to Many relation can be expressedeasily in a network model

    This is not possible in hierarchical model

    Records are linked to each other usingconnectors

  • 8/12/2019 Database and RDBMS Concepts Session 1

    35/42

    Advantages of Network model

    Insert You can simply insert a new part or supplier

    without any need to establish any link

    Delete Deleting a supplier or a part does not delete

    recursively

    Similarly, just by deleting the connector, the link

    between supplier and parts can be broken.Update Since suppliers and parts occur only once,

    updating requires only change to be made to asingle record rather than searching and updatingmany records

  • 8/12/2019 Database and RDBMS Concepts Session 1

    36/42

    Relational ModelS# SNAME STATUS CITY

    S1 Smith 20 London

    S2 Jones 10 Paris .

    S3 Blake 30 Paris .

    S

    P# Pname Color Weight City .

    P1 Nut Red 12 London .

    P2 Screw Red 17 Paris .

    P3 Bolt Blue 17 Rome .

    P4 Screw Yellow 14 London .

    P

    S# P# Qty

    S1 P1 200

    S1 P2 100

    S1 P3 300

    S1 P4 230

    S2 P2 100

    SP

  • 8/12/2019 Database and RDBMS Concepts Session 1

    37/42

    Relational Model

    In relational model the data is simplyrepresented in the form of tables

    If you compare, these three tables closely

    resemble sequential filesCompared to the other two models, relationalis simple to understand

    There are no links or pointers which connectdifferent tables

    The model is called relational because it usesrelational algebra to represent and manage

    information

  • 8/12/2019 Database and RDBMS Concepts Session 1

    38/42

    More On Relational Model

    Each row is called as a tuple

    Each column is called as a attribute

    Domain It is a set of permissible values that can be stored

    in an attribute

    This feature is not available in the other models

    Relational model provides a set of operatorsto the user. Using these operators, the usercan perform any operations on the tables.

    Advantages of Relational

  • 8/12/2019 Database and RDBMS Concepts Session 1

    39/42

    Advantages of RelationalModel

    Insert Adding a new supplier or a part is not a problem.

    They are independent entities

    If you want to represent a relation betweensupplier and parts, then insert a tuple in SP table.

    Delete Delete operations are independent of other tables

    Update Updating supplier or part information is very

    simple

    Management Systems

  • 8/12/2019 Database and RDBMS Concepts Session 1

    40/42

    Management Systems(RDBMS)

    The basic functionality of RDBMS wasconceptualized by Dr. E F Codd, when he wasworking for IBM

    He laid down certain principles which govern thefunctioning of any RDBMS

    In 1974, the first standard of SQL was also

    developedAlso C J Date from IBM also contributedtowards standardization of RDBMS

  • 8/12/2019 Database and RDBMS Concepts Session 1

    41/42

    Commercial Packages

    Hierarchical Model : IMS

    Network Model : IDMS

    Relational Model : DB2, ORACLE,

    SYBASE,ACCESS,INFORMIX, SQL Server

  • 8/12/2019 Database and RDBMS Concepts Session 1

    42/42

    End of Session 1