dbms_1.ppt

Upload: indrajani-katupitiya

Post on 02-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 DBMS_1.ppt

    1/37

    IST 210

    1

    Databases and DBMSs

    Todd S. BacastowJanuary 2005

  • 8/10/2019 DBMS_1.ppt

    2/37

    IST 210 Evolution

  • 8/10/2019 DBMS_1.ppt

    3/37

    IST 210 Ways of storing data

    Files (1960) (ancient times)

    Databases

    Hierarchical (1970)

    Network (1970)

    Relational (1980)

    Object (1990)

  • 8/10/2019 DBMS_1.ppt

    4/37

    IST 210 File terms

    Record

    data items related to a single logical entity (e.g.a students information) or row in a table

    Field a place for a data item in a record (first name

    field in a student record) or a column in a table

    File

    a sequence of records of the same type (thetable)

  • 8/10/2019 DBMS_1.ppt

    5/37

    IST 210 File structures

    3 Smith Jane A

    1 Wood Bob C

    2 Kent Chuck B

    4 Boone Dan B

    ID Last First Grade

    record

    fieldA file: STUDENT

  • 8/10/2019 DBMS_1.ppt

    6/37

    IST 210 File organization

    Serial

    new records appended

    Sequential

    records ordered in file, usually according toa numeric key

  • 8/10/2019 DBMS_1.ppt

    7/37

    IST 210 File structures

    Serial

    list of entries in

    which the orderof entry into thelist determinesthe order of thelist

    3 Smith Jane A

    1 Wood Bob C

    2 Kent Chuck B

    4 Boone Dan B

    ID Last First Grade

  • 8/10/2019 DBMS_1.ppt

    8/37

    IST 210 File structures

    Search of a simple

    list entails goingthrough each recorduntil the query issatisfied (linear

    search), which isinefficient

    3 Smith Jane A

    1 Wood Bob C

    2 Kent Chuck B

    4 Boone Dan B

    ID Last First Grade

  • 8/10/2019 DBMS_1.ppt

    9/37

    IST 210 File structures

    Sequential

    list of entriesordered in someway (e.g.numerically oralphabetically)

    1 Wood Bob C

    2 Kent Chuck B

    3 Smith Jane A

    4 Boone Dan B

    ID Last First Grade

  • 8/10/2019 DBMS_1.ppt

    10/37

    IST 210 File structures

    Search of an

    orderedsequential list canuse a searchmethod

    1 Wood Bob C

    2 Kent Chuck B

    3 Smith Jane A

    4 Boone Dan B

    ID Last First Grade

  • 8/10/2019 DBMS_1.ppt

    11/37

    IST 210 File structures

    Indexes provide a reference to records based on an indexfield, which is ordered

    Boone *

    Kent *

    Smith *

    Wood *

    1 Wood Bob C

    2 Kent Chuck B

    3 Smith Jane A

    4 Boone Dan B

    ID Last First GradeLast Pointer

  • 8/10/2019 DBMS_1.ppt

    12/37

    IST 210 Problems with files

    Redundancy number of files grows with

    applications, and data isduplicated

    Inconsistency data is updated in one

    applications files, but not inanothers

    Maintenance problems changes to data structures

    mean changes to manyprograms

    Difficulty combining data business needs may mean

    users want data fromdifferent applications

  • 8/10/2019 DBMS_1.ppt

    13/37

    IST 210 Other ways to organize

    Data model

    A data model is a particular way of conceptually organizingmultiple data files in a database

    Other common models

    Hierarchical

    Network

    Relational

    Object

  • 8/10/2019 DBMS_1.ppt

    14/37

    IST 210 Network model

  • 8/10/2019 DBMS_1.ppt

    15/37

    IST 210 Network data model

    Relationships:

    one-to-one one-to-many many-to-one many-to-many

    Class

    Student

    Grade

    Instructor

    ID Department

  • 8/10/2019 DBMS_1.ppt

    16/37

    IST 210 Network data model

    Advantages

    flexible, fast, efficient

    Disadvantages

    Complex

    Restructuring can be difficult because ofchanging all the pointers

  • 8/10/2019 DBMS_1.ppt

    17/37

    IST 210 Hierarchical database model

  • 8/10/2019 DBMS_1.ppt

    18/37

    IST 210 Hierarchical data model

    Parent-child

    relationship: one-to-one

    one-to-many

    Class

    Student

    Grade

    Instructor

    ID Department

  • 8/10/2019 DBMS_1.ppt

    19/37

    IST 210 Hierarchical data model

    Advantages

    easy to search

    add new branches easily Disadvantages

    Must establish the types of search prior to

    development of the hierarchical structure

  • 8/10/2019 DBMS_1.ppt

    20/37

    IST 210 Summary

    Hierarchical and network data models havegenerally been replaced by the relational data

    model Relational databases dominate the database

    market Oracle

    Informix SQL Server

    DB2

    ..

  • 8/10/2019 DBMS_1.ppt

    21/37

    IST 210 Relational database model

    Stores both

    Data about realworld objects(entities) intables

    Relationships

    between thetables

  • 8/10/2019 DBMS_1.ppt

    22/37

    IST 210 Relational database

    Fields (columns) in thetable store attributes. Each attribute has a

    specific domain.

    Tuples (or records orrows) in the table storeinformation. Each tuple is a unique

    instance of an object.

    Tables are composed ofa set of tuples. A table is also called a

    relation.

  • 8/10/2019 DBMS_1.ppt

    23/37

  • 8/10/2019 DBMS_1.ppt

    24/37

    IST 210 Records

    Each record represents a logical entity (e.g. astudent)

    Each field represents an attribute of thelogical entity

    1 Wood Bob C IST357

    2 Kent Chuck B IST115

    3 Smith Jane A IST357

    4 Boone Dan B IST357

    ID Last First Grade Class

    Student

  • 8/10/2019 DBMS_1.ppt

    25/37

    IST 210 Keys

    Each table has a primary key, one field (or acombination of fields) that has a unique value foreach and every record in the table

    IDis the primary keyin this table (two

    students may shareeither a last or firstname)

    1 Wood Bob C IST357

    2 Kent Chuck B IST1153 Smith Jane A IST357

    4 Boone Dan B IST357

    ID Last First Grade Class

    Student

  • 8/10/2019 DBMS_1.ppt

    26/37

    IST 210 Relating tables

    Tables can be related (joined) together based on their keys The idea is to decompose into separate tables with no

    redundancy and to provide a capability to reassemble with noinformation loss

    1 Wood Bob C IST357

    2 Kent Chuck B IST1153 Smith Jane A IST357

    4 Boone Dan B IST357

    ID Last First Grade Class

    Student

    IST357 48 Jones

    IST115 120 Brower

    IST20 120 Fountain

    Class

    Name #Stud Instructor

  • 8/10/2019 DBMS_1.ppt

    27/37

    IST 210 Relating tables

    1 Wood Bob C IST357

    2 Kent Chuck B IST115

    3 Smith Jane A IST357

    4 Boone Dan B IST357

    ID Last First Grade Class

    Student

    IST357 48 Jones

    IST115 120 Brower

    IST20 120 Mennis

    Class

    Name #Stud Instructor

    Primary key Primary keyForeign key

  • 8/10/2019 DBMS_1.ppt

    28/37

    IST 210 Relating tables

    1 Wood Bob C IST357

    2 Kent Chuck B IST115

    3 Smith Jane A IST357

    4 Boone Dan B IST357

    ID Last First Grade Class

    Student

    IST20 120 Brower

    IST115 120 Jones

    IST357 48 Jones

    Class

    Name #Stud Instructor

    Jones 332

    Brower 517

    Instructor

    Name Office

  • 8/10/2019 DBMS_1.ppt

    29/37

    IST 210 DBMS Schema

    Ultimately data in databases is stored infiles, but their structure is hidden

    Conceptual Schema

    External Schema

    Internal Schema

    The view on data used byapplication programs.

    The logical model of data that is

    separate from how it is used.

    The physical storage of data infiles and indexes.

  • 8/10/2019 DBMS_1.ppt

    30/37

    IST 210 RDBMS Features

    Data Definition Language(DDL)

    Data Manipulation Language

    (DML) Integrity Constraints

    Transaction Management

    Concurrency

    Security Tuning of Storage

  • 8/10/2019 DBMS_1.ppt

    31/37

    IST 210 Data integrity and validation (Constraints)

  • 8/10/2019 DBMS_1.ppt

    32/37

    IST 210 Relationships

    Link betweenentities.

    A relationship maydefine constraints.

    E.G, a person canonly have one SSN.

  • 8/10/2019 DBMS_1.ppt

    33/37

    IST 210 Advantages of RDBMS

    Eliminate unnecessary duplication of data

    Enforce data integrity through constraints

    Changes to conceptual schema need not

    affect external schema

    Changes to internal schema need not affectthe conceptual schema

    Many tools are available to manage thedatabase

  • 8/10/2019 DBMS_1.ppt

    34/37

    IST 210 Disadvantages of RDBMS

    To store objects (e.g., drawings) in arelational database, the objects have to be

    flattened into tables

    e.g., a digital representation of a parcel must beseparated from the behaviour of other parcels

    Complex objects have to be taken apart andthe parts stored in different tables

    When retrieved from the database, the objecthas to be reassembled from the parts indifferent tables

  • 8/10/2019 DBMS_1.ppt

    35/37

    IST 210 Other Types of DBMS

    Object DBMS

    store objects as objects

    designed to handle complex nested objectsfor graphical and multimedia applications

    Object-relational DBMS

    hybrid databases that can store data in

    tables but can also store objects in tables

  • 8/10/2019 DBMS_1.ppt

    36/37

    IST 210 Object DBMS

    ODBMS have theadvantage thatobjects can be

    stored directly Object databases

    are closely linkedto programminglanguages withways of navigatingthrough thedatabase

  • 8/10/2019 DBMS_1.ppt

    37/37

    IST 210 Summary

    Commonword

    Textbookword

    Alternateword

    Object word

    Table Relation File or Data set

    (old)

    Object class

    Column Attribute Field Object field

    Domain Domain Range ofpossible values

    Datatype,subtype

    Row Tuple Record Object instance

    Primary key Primary key Key of therecord

    Object identifier