04_05 modeling and design framework

Upload: sanket-katole

Post on 08-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 04_05 Modeling and Design Framework

    1/70

    1

    Session 04 and 05

    Database SystemModeling and design Framework

    TUE 23/11/2010

  • 8/7/2019 04_05 Modeling and Design Framework

    2/70

    2

    K ey Terms cont.

    Database System

    A database, a database managementsystem and appropriate hardware andpersonnel.

    number,Designation

    Hoursworked, Pay

    rateInsurance,

    Pension

  • 8/7/2019 04_05 Modeling and Design Framework

    3/70

    3

    Database System: Hardware

    Set of physical devices on which a

    database resides. It consists of oneor more computers, disk drives, CRTterminals, printers, tape drives,connecting cables and other auxiliary and connecting hardware.

  • 8/7/2019 04_05 Modeling and Design Framework

    4/70

    4

    Database System: Hardware cont.

    Client

    Client

    Server

    TAPEPrinter

  • 8/7/2019 04_05 Modeling and Design Framework

    5/70

    5

    Database System: Software

    A database software includes two types of software General-purpose database management

    software, usually called the databasemanagement system (DBMS)

    Application software that uses DBMS

    facilities to manipulate the database toachieve a specific business function, such asproviding reports or documents, which canbe used by users.

  • 8/7/2019 04_05 Modeling and Design Framework

    6/70

    6

    Database System: Software cont.

    Application software is generally writtenstandard programming language such as

    C, or it may be written in a language(commonly called a fourth-generationlanguage) supplied with the DBMS.

    These programs utilise the commandlanguage of the DBMS and make use of the information contained in the datadictionary.

  • 8/7/2019 04_05 Modeling and Design Framework

    7/70

    7

    Database System: Software cont.

    User Interface Language, menus and other facilities by

    which users interact with various systemcomponents, such as application programs,the DBMS

    Computer-aided software engineering(CASE) tools Automated tools used to design databases

    and application programs.

  • 8/7/2019 04_05 Modeling and Design Framework

    8/70

    8

    Data Dictionary/Directory(Repository)

    A subsystem that keeps track of the definitions of all data items in the database.

    relationships that exists between variousdata structures.

    indexes that are used to access data quickly.

    screen and report format definitions thatmay be used by various applicationprograms.

  • 8/7/2019 04_05 Modeling and Design Framework

    9/70

    9

    Data DictionaryDefinitions of data items in the databaseincludes:

    Elementary-level data items (fields),

    group and record-level data structures, and

    files or relational tables.

  • 8/7/2019 04_05 Modeling and Design Framework

    10/70

    10

    Data that describe the properties orcharacteristics of data.Some of these properties include data definitions,data structures and rules or constraints. Itemname, the data type, length, minimum andmaximum allowable values (where appropriate)and a brief description of each data item.

    Metadata allow database designers and users tounderstand what data exist, what the data mean.Data without clear meaning can be confusing,misinterpreted.

    Metadata

  • 8/7/2019 04_05 Modeling and Design Framework

    11/70

    11

    E.g.Data Item ValueName Type Length Min Max DescriptionName Character 30 Employee NameID Number 9 Employee No.Dept Character 10 Dept. No.Age Integer 2 18 60 Employee Age

    Name Character 15 Dept. NameManager Number 9 Mgr. Emp. No.

    Employee No. (ID) uniqueManager is an employee of the organisation

    Metadata

  • 8/7/2019 04_05 Modeling and Design Framework

    12/70

    12

    Database System: People

    Two different types of people ( users andpractitioners ) are concerned with thedatabase.

    Users who need information from the database to

    carry out their primary businessresponsibility

    e.g. Executives, managers, staff, clericalpersonnel

  • 8/7/2019 04_05 Modeling and Design Framework

    13/70

    13

    Database System: People cont.

    Practitioners

    people responsible for the database

    system and its associated applicationsoftware.

    e.g. Database administrators, analysts,programmers, database and systemdesigners, information systems managers.

  • 8/7/2019 04_05 Modeling and Design Framework

    14/70

    14

    Components of a Database System

    Four components: People, H/W, S/W, Data

    Practitioners (analysts and databasedesigners) in consultation with usersidentify data needs and design databasestructures to accommodate these needs.

    The database structures are specified tothe DBMS through the data dictionary.

  • 8/7/2019 04_05 Modeling and Design Framework

    15/70

  • 8/7/2019 04_05 Modeling and Design Framework

    16/70

    16

    Components of a DBS cont.

    DATAB

    ASE

    DATADICTIONARY/DIRECTORY

    ApplicationPro gram

    ApplicationPro gram

    ApplicationPro gram

    DB MS

    Computer Terminals

    PRINTER

    Analyst

    User

  • 8/7/2019 04_05 Modeling and Design Framework

    17/70

    17

    K ey Terms cont.Database Management System

    Systems software that facilitates the

    management of a database.E.g. Oracle, Access, SQL Server

  • 8/7/2019 04_05 Modeling and Design Framework

    18/70

    18

    Database Management System(DB MS)

    DBMS

    An application software thatorganises data into records in oneor more databases and allowsorganising, accessing and sortingof the data in a variety of formats.

  • 8/7/2019 04_05 Modeling and Design Framework

    19/70

    19

    DB MS cont.

    Relational DBM S M ost common type of DBM S.

    D ata elements are stored indifferent tables made up of rowsand columns. Relates data in

    different tables through the useof common data element(s).

  • 8/7/2019 04_05 Modeling and Design Framework

    20/70

    20

    Components of a DBMS

    DATABASE

    DATADICTIONARY/DIRECTORY

    USER

    PROGRA MM ER

    Data Dictionary/Directory

    SubsystemSecurity and

    Inte gritySubsystem

    Database AccessSubsystem

    User Query and

    Reportin g Facilities

    ApplicationPro gram

    Development

    Facilities

    DB MS

    USER

    PROGRA MM ER

  • 8/7/2019 04_05 Modeling and Design Framework

    21/70

    21

    Data Security

    The database is a valuable resourceneeding protection.

    The DBMS provides database securityby limiting access to the database toauthorised personnel.

    Authorised users will generally berestricted as to the particular data theycan access and whether they can updateit.

  • 8/7/2019 04_05 Modeling and Design Framework

    22/70

    22

    Data Security

    Access is often controlled by passwordsand by data views, which are definitionsof restricted portions of the database.

    1

    Data items

    2 3 4

  • 8/7/2019 04_05 Modeling and Design Framework

    23/70

    23

    Data Integrity

    The integrity and consistency of thedatabase are protected via constraints onvalues that data items can have and bybackup and recovery capabilitiesprovided within the DBMS.

    Data constraint definitions aremaintained in the data dictionary.

  • 8/7/2019 04_05 Modeling and Design Framework

    24/70

    24

    Data Integrity

    Backup and recovery are supported bysoftware that automatically logs changesto the database and provides for a meansof recovering the current state of thedatabase in case of system failure.

  • 8/7/2019 04_05 Modeling and Design Framework

    25/70

    25

    Concurrent Data Access

    One of the chief functions of the DBMSis to support the access, retrieval andupdate of data in the database.

    The DBMS provides the physicalmechanisms allowing multiple users toaccess a variety of related data quicklyand efficiently.

  • 8/7/2019 04_05 Modeling and Design Framework

    26/70

    26

    User-Oriented Data Manipulation

    DBMS provides user-oriented datamanipulation tools.

    Easy-to-use query languages allow usersto formulate queries and request one-time reports directly from the database.

    Often query languages will containfacilities to format the results of queriesas reports.

  • 8/7/2019 04_05 Modeling and Design Framework

    27/70

    27

    Data Manipulation

    Report generators have more powerfulreporting facilities than those in thequery language.

  • 8/7/2019 04_05 Modeling and Design Framework

    28/70

    28

    Application Development

    The DBMS commonly providessignificant assistance to the applicationprogrammer. Tools for screen, menu and report

    generation

    application generators

    compilers

    data and view definition facilities

  • 8/7/2019 04_05 Modeling and Design Framework

    29/70

    29

    Application Development

    Modern database systems providelanguage components that are muchmore powerful than those of traditionallanguages, making the programmingprocess itself considerably more efficient. Developer 2000/PowerBuilder for Oracle

    Visual Basic for Microsoft SQL server

  • 8/7/2019 04_05 Modeling and Design Framework

    30/70

    30

    Database ApplicationsD atabases range from those for a

    single user with a desktop computer to those on mainframe computerswith thousands of users.

    Personal databases

    Workgroup databases

    Departmental databases

    Enterprise databases

  • 8/7/2019 04_05 Modeling and Design Framework

    31/70

    31

    Personal Computer DatabasesD esigned to support one user with a

    standard alone PC.

    E.g. a sales person keeping track of this customer information withcontact details.

  • 8/7/2019 04_05 Modeling and Design Framework

    32/70

    32

    Workgroup DatabasesA relatively small team of people (less

    than 25) who collaborate on thesame project or application.

    E.g. a software development teammaintaining a list of softwareobjects.

  • 8/7/2019 04_05 Modeling and Design Framework

    33/70

    33

    Department DatabasesA department is a functional unit of an

    organisation. It is larger than aworkgroup.

    D epartment databases are designed tosupport the various functions andactivities of a department.

    E.g. a personnel database that is designedto track data concerning employees, jobs,skills and job assignments.

  • 8/7/2019 04_05 Modeling and Design Framework

    34/70

    34

    Enterprise DatabasesAn enterprise is one whose scope is

    the entire organisation or enterprise.

    Such databases are intended tosupport organisation-wideoperations and decision making.

    E.g. a large health care organisation thatoperates a group of medical centre'sincluding hospitals, clinics and nursinghomes.

  • 8/7/2019 04_05 Modeling and Design Framework

    35/70

    35

    Enterprise Databases cont.An enterprise database does support

    information needs from manydepartments. The most importanttype of enterprise database today iscalled a data warehouse.

    Data warehouse

    An integrated decision support databasewhose content is derived from the variousoperational databases.

  • 8/7/2019 04_05 Modeling and Design Framework

    36/70

    36

    Database Environment

    Marketing Purchasing

    Accounting

    Marketin g

    Sales Advertisin g

    Accountin g

    AccountsReceivable

    AccountsPayable

    Corporate Database

  • 8/7/2019 04_05 Modeling and Design Framework

    37/70

    37

    3 Level ANSI/SPARC Architecture

    ANSI SPARC is an acronym for the American National StandardInstitute Standard Plannin g and Requirements Committee.A standard three level approach to database desi gn has been a greed.

    - External level- Conceptual level- Internal level (includes physical data stora ge)

    The 3 Level Architecture has the aim of enablin g users to access thesame data but with a personalized view of it. The distancin g of theinternal level from the external level means that users do not need toknow how the data is physically stored in the database. This levelseparation also allows the Database Administrator (DBA) to chan gethe database stora ge structures without affectin g the users' views.

    Made databases more independent of applicationBecame a standard for the or ganisation of DB MS

  • 8/7/2019 04_05 Modeling and Design Framework

    38/70

    38

    3 LevelsExternal Users and Applications view of data

    Conceptual Logical Data Model

    Physical Physical data Model

  • 8/7/2019 04_05 Modeling and Design Framework

    39/70

    39

    External (Sub) Schema defines the external view of data

    as seen by a user or program

    Conceptual Schema defines the logical view of dataas seen by all users and programs

    Physical (Internal) Schema defines the physical view of data

    as seen by a DBMS

  • 8/7/2019 04_05 Modeling and Design Framework

    40/70

    40

    user a user i /program j program x

    sub-schema a sub-schema i sub-schema z

    conceptual schema

    physical schema

    3 Level Architecture

    Databases

  • 8/7/2019 04_05 Modeling and Design Framework

    41/70

    41

    Name (20 characters) Address (40 characters)

    NID (10 char) Designation (15 char)

    Physical View

    database

    A.B.C. Rudra Prasad | 222 , Gole Road, Pune |

    65 037 069 0V | Lecturer

    The DBMS must know exact physical location precise physical structure

    Employee record

  • 8/7/2019 04_05 Modeling and Design Framework

    42/70

    42

    Physical ViewPhysical view provides the disk drives,physical addresses, indexes and pointers.Physical Database Design is theresponsibility of the DatabaseAdministrator (DBA). No user is concernedwith this view.

    Physical devices to contain the dataAccess methods to retrieve and update datamaintain and improve database performance

  • 8/7/2019 04_05 Modeling and Design Framework

    43/70

    43

    database

    Logical View

    Address 222 , Galle Road, Colombo

    The user/application mustknow

    existence logical reference Employee

    Name A.B.C. De Silva

    Designation Senior Lecturer

    NID 65 037 069 0V

  • 8/7/2019 04_05 Modeling and Design Framework

    44/70

    44

    Logical ViewThis is a single logical description of alldata elements and their relationships.It is the result of the conceptual designwhich involves analysis of all usersinformation needs and data definitionof data items needs to meet them.

    SQL CREATE TABLE statement isused to define the data elements.

  • 8/7/2019 04_05 Modeling and Design Framework

    45/70

    45

    database

    External View

    Department Dept. of Computer Science

    The user/application see authorised data

    own formatLecturer

    Name A.B.C. De Silva

    Designation Senior Lecturer Age 35

  • 8/7/2019 04_05 Modeling and Design Framework

    46/70

    46

    External View

    This consists of user views of thedatabase.

    Each definable user group will have itsown view of the database.Each of these views gives a user-

    oriented description of the dataelements and relationships of which theview is composed.

  • 8/7/2019 04_05 Modeling and Design Framework

    47/70

    47

    A logical description of some portion of the database that is required by a userto perform some task.

    E.g. Benefit application user will viewpart of the employee data, excludingdata such as date of birth and salary.

    User View

  • 8/7/2019 04_05 Modeling and Design Framework

    48/70

    48

    External View

    It can be derived directly from theconceptual schema.

    The collection of all user views is theexternal level.SQL CREATE VIEW statement is used

    to create these views and SQL GRANTstatement is used to restrict its use to auser group.

  • 8/7/2019 04_05 Modeling and Design Framework

    49/70

    49

    External Views Allows to hide unauthorised data

    e.g. s alary, dob

    provide user viewe.g. view employee n ame, de s ig n atio n ,departme n t data taken from employee and

    departmen

    t files derive new attributes

    e.g. age derived from dob or n id

    External View cont.

  • 8/7/2019 04_05 Modeling and Design Framework

    50/70

    5 0

    External Views Allows to change unit of measurement

    e.g. show age in years or months define security levels

    e.g. update access to employee fileread-only to departme n t file

    External View cont.

  • 8/7/2019 04_05 Modeling and Design Framework

    51/70

    5 1

    Mapping between Levels

    DBMS map or translate from one levelto another.

    External ConceptualConceptual Physical

    Database exists in reality only at theinternal level.

  • 8/7/2019 04_05 Modeling and Design Framework

    52/70

    5 2

    user a user i /program j program x

    sub-schema a sub-schema i sub-schema z

    conceptual schema

    physical schema

    Databases

    DDL

    SDDL

    DML/SQL

    Practitioners:DBA

    Users

  • 8/7/2019 04_05 Modeling and Design Framework

    53/70

    5 3

    Data Definition Language (DDL)- is the language component of a DBMS

    that defines each data element as itappears in the database.

    Sub-Schema Data Definition Language(SDDL)

    - is the language component of a DBMSthat defines data elements as it shouldappear to the end users andprogrammers.

    Practitioners:DBA

  • 8/7/2019 04_05 Modeling and Design Framework

    54/70

    5 4

    Data Manipulation Language (DML)- is a language associated with a DBMS

    that is employed by end users and

    programmers to manipulate data in thedatabase.

    Structured Query Language (SQL)

    - pronounced as sequel, is the standarddata manipulation for relational DBMSs.

    User

  • 8/7/2019 04_05 Modeling and Design Framework

    55/70

    55

    Characteristics of Early DBMS

    Centralised Storage ManagementTransaction ManagementRecovery FacilitiesSystem Maintained Access Paths

  • 8/7/2019 04_05 Modeling and Design Framework

    56/70

    56

    Characteristics of Modern DBMSQuery processing and optimisationTransaction management

    Concurrency controlDatabase recoveryDatabase security and authorisation

    Distributed databasesData warehousing and data mining

  • 8/7/2019 04_05 Modeling and Design Framework

    57/70

    57

    Function of a DBMSFunctions of a DBMS are concerned with

    providing efficient flexible dataprocessing capabilities withoutcompromising data validity.

    Main Functions are: Shared data

    Control redundancy Data integrity Data security

  • 8/7/2019 04_05 Modeling and Design Framework

    58/70

    58

    Capabilities of a DBMS

    Capabilities vary considerable, but basicoperations are:Data definitionData entryData manipulationData display

  • 8/7/2019 04_05 Modeling and Design Framework

    59/70

    59

    AdvantagesProgram-data independenceMinimal data redundancyImproved data consistencyImproved data sharingIncreased productivity of applicationdevelopmentEnforcement of standardsImproved data qualityImproved data accessibility and responsivenessReduced program maintenance

    Database Approach

  • 8/7/2019 04_05 Modeling and Design Framework

    60/70

    6 0

    The separation of data descriptions(metadata) from the application programsthat use the data.

    In the database approach data descriptionsare stored in a central location called thedata dictionary. This property allows anorganisations data to change and evolve(within limits) without changing theapplication program that process the data.

    Program-Data/Data Independence

  • 8/7/2019 04_05 Modeling and Design Framework

    61/70

    6 1

    Data files are integrated into a single,logical structure. Each primary fact isrecorded (ideally) in only one place in thedatabase.

    E.g. Employee data not with the payroll andbenefit files.

    Note: Data redundancy is not eliminated

    entirely. Some data items will appear inmore than one place (e.g. employee no.) torepresent the relationship with others.

    Minimal Data Redundancy

  • 8/7/2019 04_05 Modeling and Design Framework

    62/70

    6 2

    By eliminating (or controlling) dataredundancy, we greatly reduce theopportunities for inconsistency.

    E.g. employee address is stored only onceand hence we cannot have disagreementon the stored values.Also, updating data values is greatlysimplified and have avoid the wastedstorage space.

    Improved Data Consistency

  • 8/7/2019 04_05 Modeling and Design Framework

    63/70

    6 3

    A database is designed as a sharedcorporate resource. Authorised usersare granted permission to use the

    database, and each user (or group of users) is provided one or more userviews to facilitate this use.

    E.g. employee data common to payroll,benefit applications will be sharedamong different users.

    Improved Data Sharing

  • 8/7/2019 04_05 Modeling and Design Framework

    64/70

    6 4

    A major advantage of the databaseapproach is that it greatly reduces thecost and time for developing new

    business applications. Programmer could concentrate on the

    specific functions required for the newapplication, without having to worry aboutdesign or low-level implementation details;as related data have already been designedand implemented.

    Increased Productivity of

    Application Development

  • 8/7/2019 04_05 Modeling and Design Framework

    65/70

    65

    DBMS provides a number of high-levelproductivity tools such as forms and reportgenerations and high-level languages that

    automate some of the activities of databasedesign and implementation.

    Increased Productivity of

    Application Development cont.

  • 8/7/2019 04_05 Modeling and Design Framework

    66/70

    66

    When the database approach is implementedwith full management support, the databaseadministration function should be grantedsingle-point authority and responsibility forestablishing and enforcing data standards.

    Standards include naming conventions, dataquality standards and uniform procedures foraccessing, updating and protecting data.

    Powerful set of tools for developing andenforcing these standards are available for someDBMS.

    Enforcement of Standards

  • 8/7/2019 04_05 Modeling and Design Framework

    67/70

    67

    A number of tools and processes are available toimprove data quality. Database designers can specify integrity

    constraints that are enforced by the DBMS. One of the objectives of a data warehouse

    environment is to clean up operational databefore they are placed in the data warehouse.

    ConstraintA rule that cannot be violated by database users.

    Improved Data Quality

  • 8/7/2019 04_05 Modeling and Design Framework

    68/70

    68

    With relational database, end users withoutprogramming experience can often retrieve anddisplay data, even when it crosses traditionaldepartmental boundaries.

    English-like query language SQL and query toolssuch as Query-By-Example provide suchfacilities.

    Improved Data Accessibilityand Responsiveness

  • 8/7/2019 04_05 Modeling and Design Framework

    69/70

    69

    Stored data are changed frequently forvariety of reasons such as new data itemstypes are added, and data formats change(e.g. date format from two-digit to fourdigit).

    Data independence allows to reduce theprogram maintenance time.

    Reduced ProgramMaintenance

  • 8/7/2019 04_05 Modeling and Design Framework

    70/70

    DisadvantagesDBMS are more vulnerable than file-basedsystem because of the centralised nature of

    a large integrated database.If a failure occurs the recovery process ismore complex and some times may resultsin lost transactions.Hardware, software and personnel cost arehigher for DBMS.

    Database Approach