Lecture01 1

download Lecture01 1

of 12

Transcript of Lecture01 1

  • 7/30/2019 Lecture01 1

    1/12

    CXB 3104

    Advanced Database Systems

    Lecture 1

    Muthu

    [email protected]

    1

    Outline

    Data & Information

    Database

    Types of database

    Database Schema

    Database models

    2

    Data

    Data can be classified as raw facts or the

    building block of information.

    These are usually unprocessed information.

    Data can exists in a variety of forms such as

    numbers or text on pieces of paper and

    bytes stored in electronic memory, or as

    facts stored in a persons mind.

    3

    Metadata describes how and when and by

    whom a particular set of data was collected,and how the data is formatted.

    Meta data

    4

  • 7/30/2019 Lecture01 1

    2/12

    Information can be classified as processed

    data.

    Information should be meaningful, relevant,

    accurate and timely.

    These are essential ingredients to good

    decision-making, which is the key to

    organizational success.

    Information

    5

    Data Management is a discipline that

    focuses on the proper generation, storage

    and retrieval of data

    Data management

    6

    What is a database?

    A collection of information organized in

    such a way that a computer program can

    quickly select desired pieces of data.

    Databases are organized as fields, records,

    and files.

    7

    Database organization

    A field is a single piece of information that

    has a specific meaning and is used to

    define and store data.

    A record is one complete set of fields

    describing a person, place or thing.

    A file is a collection of related records.

    8

  • 7/30/2019 Lecture01 1

    3/12

    Database management system

    To access information from a database, you

    need a database management system

    A DBMS is a collection of programs that

    enables you to store, modify, and extract

    information from a database.

    DBMSs makes data management moreeffective

    9

    Advantages of DBMS

    The end-users has better access to more

    and better-managed data.

    Allows integrated view of organizations

    data leading.

    The ability to produce quick responses to

    ad hoc queries.

    10

    DBMS Facilities

    Data Manipulation Language

    has a central repository for all data and data

    descriptions

    provides inquiry facilities to this data called a

    query language.

    Data Definition Language

    allows users to specify the data-type and

    structures, and the constraints on that data to

    be stored in the database

    11

    Types of Databases

    Single-userdatabase

    Desktop database

    Multi-userdatabase

    Workgroup database

    Enterprise database

    12

  • 7/30/2019 Lecture01 1

    4/12

    A centralized database is one that supports datalocated at a single site.

    A distributed database is a single logical database thatis spread physically across computers in multiplelocations

    The transactional database is used to processtransactions

    A data-warehouse database focuses on storage ofdata that will be used for information generation for the

    purpose of decision-making.

    Other classifications of Databases

    13

    Database Design

    Database design refers to the design of the database

    structure that will be used to store and manage data.

    It does NOT refer to the designing the DBMS software.

    A well- designed database will minimize the problem of

    data-redundancy.

    A poorly designed database tends to generate errors

    14

    Schema

    Database Schema:

    The description of a database.

    Includes descriptions of the database

    structure, data types, and the constraints on

    the database.

    15

    Database Schema vs. Database State

    Distinction

    The database schema changes very

    infrequently.

    The database state changes every time the

    database is updated.

    16

  • 7/30/2019 Lecture01 1

    5/12

    Example of a Database Schema

    17

    Example of a database state

    18

    Three-Schema Architecture

    Proposed to support DBMS

    characteristics of:

    Program-data independence.

    Support ofmultiple views of the data.

    Not explicitly used in commercial DBMS

    products, but has been useful in explaining

    database system organization

    19

    Three-Schema Architecture

    Defines DBMS schemas at three levels:

    Internal schema at the internal level to describe physical

    storage structures and access paths (e.g. indexes).

    Typically uses a physical data model.

    Conceptual schema at the conceptual level to describe

    the structure and constraints for the whole database for a

    community of users.

    Uses a conceptual or an implementation data model.

    External schemas at the external level to describe the

    various user views.

    Usually uses the same data model as the conceptual schema.

    20

  • 7/30/2019 Lecture01 1

    6/12

    The three-schema architecture

    21

    Data Independence

    Logical Data Independence:

    The capacity to change the conceptualschema without having to change the externalschemas and their associated applicationprograms.

    Physical Data Independence:

    The capacity to change the internal schemawithout having to change the conceptualschema.

    For example, the internal schema may bechanged when certain file structures arereorganized or new indexes are created toimprove database performance

    22

    A clear description of a policy, procedure, or principlewithin an organizations environment.

    Properly written business rules are used to define entities,attributes relationships and constraints.

    To be effective, a business rule must be easy to understandand widely disseminated to ensure that every person in theorganization shares a common interpretation.

    Business rules

    23

    Examples

    A customer may generate many invoices.

    Only one customer generates each invoice.

    A minimum of 15 participants is needed for the

    training to be scheduled

    Business rules

    24

  • 7/30/2019 Lecture01 1

    7/12

    They help standardize the companys view of data.

    They constitute a communications tool between users

    and designers.

    They allow the designer to understand the nature, role

    and scope of all data.

    They allow the designer to understand business

    processes.

    They allow the designer to develop appropriate

    relationship participation rules and constraints. .

    Business rules Why?

    25

    Records are arranged in a top-down

    structure

    The parent and child are often used in

    describing hierarchical model

    a child is related to only one parent

    Hierarchical Model

    26

    Hierarchical Model

    DEPARTMENT

    DEPTNO DNAME LOCATION

    D NA ME A GE C OD E S NA ME N OY EA RS

    IDENT COST NUMBER

    EQUIPMENT EMPLOYEE

    SKILLDEPENDENT

    EMPNO ENAME YEARS

    27

    Network Data Model

    no distinction between parent and child recordtypes

    Any record type may be associated with any number ofdifferent record types

    network schema - the conceptual organization of theentire database as viewed by the database administrator.

    The subschema, which defines the portion of thedatabase seen by the application programs thatactually produce the desired information from the datacontained in the database.

    28

  • 7/30/2019 Lecture01 1

    8/12

    DEPARTMENT

    EMPNO ENAME YEARS

    DEPTNO DNAME LOCATION

    EMPLOYEE PROJECT

    PROJNO DESCRIPTION

    DEPT-EMP DEPT-PROJ

    PROJ-EMP

    Network Data Model

    29

    Relational Model

    Based on the mathematical concept of a relation, represented as atable.

    A table stores a collection of related entities.

    The database resembles a file but a unlike a file a table yields completedata and structural independence because it is purely logical.

    How the data is stored in the database is of no consequence to the useror designer.

    A table is a matrix made up a series of row and columns.

    30

    Relational Model

    Bno. Street location PostCode TelNo.

    B1 22, Oxley Rd Central 589652 67894561

    B2 44, Shenton Way South 548796 67896325

    B3 11, Chai Chee Rd East 585698 67665892

    B4 4, Jurong West Drive West 526478 68875425

    Sno.

    F name L na me P os it io n Sal ar

    y

    Sex Bno

    S11 John Doe Manager 5000 M B1

    S12 Stella Chan Clerk 1800 F B3

    S14 Muthu Ramasam

    y

    Senior Exec 3200 M B3

    31

    Structural Independence

    Improved conceptual simplicity

    Easier design, implementation and

    management

    Ad hoc query capability

    Powerful DBMS

    Advantages of the Relational model

    32

  • 7/30/2019 Lecture01 1

    9/12

    Substantial overhead

    Can facilitate poor design and implementation

    Promote islands of information problem

    Disadvantages of the Relational

    model

    33

    Object-oriented Model

    Objects are abstraction of the real world

    entities that exhibit states and behaviors

    state of objects is expressed as values of the

    attributes of the object

    behavior of an object is expressed by a set of

    methods that operate on its attributes.

    34

    Features of OO data model

    An object is an abstraction of real-world entity. It represents a singleoccurrence of an entity.

    Attributes describe the properties of an object. Objects that sharesimilar characteristics are grouped in classes.

    A class is a collection of similar objects with shared structure.

    A methodrepresents a real-world action such as display; to print out thedetails of the Student. Methods define the behavior of an object.

    Classes are organized in a class hierarchy.

    Inheritance is the ability of an object within the class hierarchy to inheritthe attributes and methods of classes above it(parent).

    35

    Advantages of the OO model

    Add semantic content

    Visual presentation includes semantic content.

    Database integrity

    Both structural and data independence

    36

  • 7/30/2019 Lecture01 1

    10/12

    Slow pace of OODM standards and development

    Complex navigational data access

    Steep learning curve

    High systems overhead slows transactions .

    Disadvantages of the OO model

    37

    Relational Database Model

    Relational Database Model

    View of data is logical rather than physical.

    DBMS in between the application and

    database allows the designer to focus on the

    logical representation of the data and their

    relationships.

    39

    Logical view of the relational database is

    facilitated by the creation of relationships

    based on a logical construct known as atable or a relation.

    Tables

    40

  • 7/30/2019 Lecture01 1

    11/12

    A table is composed of rows and columns.

    Each row (tuple) represents a single occurrence.

    Each column represents an attribute and is uniquelynamed.

    Each row/column intersection represents a single piece ofdata.

    All values in a single column must be of the same dataformat.

    The range of possible values of a column is known as theattribute domain.

    Each table must have an attribute or combination of

    attributes that uniquely identifies each row.

    Table characteristics

    41

    Table - example

    Bno. Street location PostCode Tel No.

    B1 22, Oxley Rd Central 589652 67894561

    B2 44, Shenton Way South 548796 67896325

    B3 11, Chai Chee Rd East 585698 67665892

    B4 4, Jurong West Drive West 526478 68875425

    42

    Candidate KeyIt is an attribute or combination of attributes thatenables each row to be uniquely identified.

    Primary keyIt is an attribute or a set of attributes that uniquelyidentify a specific instance of an entity.

    Composite KeyIt is a primary key that made up of more than oneattribute.

    Secondary keyAn attribute or combination of attributes usedstrictly for data retrieval purposes.

    Foreign Key- An attribute whose values match primary key values inthe related table

    Relational Keys

    43

    Relational Keys

    44

  • 7/30/2019 Lecture01 1

    12/12

    Integrity rules

    Entity integrity

    primary key can never be a null value

    used to identify a unique row in a relational table

    its value must always be specified.

    insert, update, and delete operations maintain the

    uniqueness and existence of all primary keys.

    Referential integrity

    A foreign key, must either be null or match the values in

    the relational table in which that foreign key is a primary

    key.

    45

    Relational tables are sets.

    Rows of the tables can be considered as

    elements of the set

    Operations that can be performed on sets

    can be done on relational tables.

    Relational Data Manipulation

    46