Top Banner

of 70

Concepts of Database

Apr 09, 2018

Download

Documents

Kuruvila Mathew
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/8/2019 Concepts of Database

    1/70

    Concepts of database

  • 8/8/2019 Concepts of Database

    2/70

    Data bases

    A database can be defined as acollection of related data items stored inan organised way so that specific items

    can be selected and retrieved quickly Centrally controlled, integrated collection

    of logically organized data.

    Data elements should be in specific placesand bear specific relationships to eachother.

  • 8/8/2019 Concepts of Database

    3/70

  • 8/8/2019 Concepts of Database

    4/70

    Advantages over conventional

    file system In conventional systems data are

    scattered over a large number of files with

    no proper integration, logical co-ordinations or centralized control.

    The data and programs are notindependent so for each application a new

    program may have to be written

    Time consuming and costly

  • 8/8/2019 Concepts of Database

    5/70

    The Objectives of a DBMS

    1. Mass storage of Relevant Data

    The Whole data is logically organise,

    integrated14 and controlled from a centralpoint.

  • 8/8/2019 Concepts of Database

    6/70

    The Objectives of a DBMS

    2. Data Access made easy

    In conventional systems it is not easy.

    Bank manager wants customers with

    amt 50000 and above. Bank manager wants customers of age

    less than 40.

    So such environment does not allow one to

    retrieve the needed data in a convenient andefficient manner

    So better methods are needed to be developed

  • 8/8/2019 Concepts of Database

    7/70

    The Objectives of a DBMS

    3. Elimination of data redundancy andinconsistency

    Data redundancy- duplication of data storing of data more than once

    Redundancy leads to inconsistency eg: Name and address stored in personal

    file as well as in salary file. Address change will lead to inconsistency

    In DBMS care should be taken to avoid suchredundant information

    Stored only once so no inconsistency

  • 8/8/2019 Concepts of Database

    8/70

    The Objectives of a DBMS

    4. Simultaneous use ofDatabases

    The system should be made available

    to multiple users at the same time toimprove the overall performance andobtain faster performance

    Eg: Railway ticker booking

  • 8/8/2019 Concepts of Database

    9/70

    The Objectives of a DBMS

    5. Data integration

    In conventional systems data is scattered invarious files in various formats

    QUANTITY in numeric oralphabetic so making new application will betdifficult.

    DBMS ensures that data type and width etc are

    explicitly defined. It also ensures some consistency constraints

    such as numeric data: minimum balance etc.

  • 8/8/2019 Concepts of Database

    10/70

    The Objectives of a DBMS

    6. Security of data base

    Database is a important asset. So security isimportant

    PAYROLL PERSON,

    CUSOMER

    DBMS ensures that only authorised persons can accessauthorised potions of the database.

    Password control, accession levels etc.

    Protections of data against accidental or deliberatedisclosure to unauthorised persons and unauthorisedmodification or destruction of data is calleddatasecurity

  • 8/8/2019 Concepts of Database

    11/70

    The Objectives of a DBMS

    7.Standards can be enforced -

    Since all access to the database must bethrough DBMS, so standards are easier to

    enforce.

    Standards may relate to the naming of data,format of data, structure of the data etc.

    Standardizing stored data formats is usuallydesirable for the purpose of data interchange ormigration between systems

  • 8/8/2019 Concepts of Database

    12/70

    The Objectives of a DBMS

    8. Backup and Recovery

    Back up copy is made regularly

    Bring the database to a statethat existed before failure.

  • 8/8/2019 Concepts of Database

    13/70

    DBMS and its structure,

    DBMS can be defined as a system whichhas a set of rules and methods that allows for

    definition, creation, retrieval, updation,maintenance and protection of the database

    DBMS (Database Management System) acts asan interface between the user and the database.

    The user requests the DBMS to perform variousoperations (insert, delete, update and retrieval)on the database.

  • 8/8/2019 Concepts of Database

    14/70

    The components ofDBMS perform these requestedoperations on the database and provide necessary datato the users.

    Data base is a program or collection of program betweenDatabase and User.

    - assist in manipulating database

    - protect database from the user

    Dbase, Clipper, Foxpro, Ms Access, Oracle, Sybase,

    Ingress, Informix, MS-SQL server, DB2 Etc. Database systems are partitioned into modules for

    different functions. Some functions (e.g. file systems)may be provided by the operating system.

  • 8/8/2019 Concepts of Database

    15/70

    Components ofDBMS File managermanages allocation of disk space and data

    structures used to represent information on disk.

    Database manager: The interface between low-level data andapplication programs and queries.

    Query processortranslates statements in a query language into

    low-level instructions the database manager understands. (Mayalso attempt to find an equivalent but more efficient form.)

    DML precompilerconverts DML statements embedded in anapplication program to normal procedure calls in a hostlanguage. The precompiler interacts with the query processor.

    DDL compilerconverts DDL statements to a set of tables

    containing metadata stored in a data dictionary.

  • 8/8/2019 Concepts of Database

    16/70

    In addition, several data structures are requiredfor physical system implementation:

    Data files: store the database itself.

    Data dictionary: stores information about thestructure of the database. It is used heavily. Greatemphasis should be placed on developing a gooddesign and efficient implementation of the dictionary.

    Indices: provide fast access to data items holdingparticular values.

    Components ofDBMS

  • 8/8/2019 Concepts of Database

    17/70

    Instances andSchemes

    Databases change over time.

    The information in a database at a particular point in timeis called an instance of the database.

    The overall design of the database is called thedatabase scheme.

    Analogy with programming languages: Data type definition - scheme

    Value of a variable - instance

    There are several schemes, corresponding to levels ofabstraction: Physical scheme

    Conceptual scheme

  • 8/8/2019 Concepts of Database

    18/70

    DATABASE LANGUAGES

    ADBMS is a software package that carries out manydifferent tasks including the provision of facilities toenable the user to access and modify information in thedatabase.

    The database is an intermediate link between thephysical database, computer and the operating systemand the users. To provide the various facilities todifferent types of users, a DBMS normally provides oneor more specialized programming languages called

    database languages. Database languages come in different forms. They are: -

    1. Data Description Language (DDL)

    2. Data Manipulation Language (DML)

  • 8/8/2019 Concepts of Database

    19/70

    Data Definition Language (DDL)

    As the name suggests, this language is used to definethe various types of data in the database and theirrelationship with each other.

    Used to specify a database scheme as a set of

    definitions expressed in a DDL DDL statements are compiled, resulting in a set of tablesstored in a special file called a data dictionary ordatadirectory.

    The data directory contains metadata (data about data)

    The storage structure and access methods used by thedatabase system are specified by a set of definitions in aspecial type ofDDL called a data storage anddefinition language

    basic idea: hide implementation details of the databaseschemes from the users

  • 8/8/2019 Concepts of Database

    20/70

    The basic functions performed

    by DDL are

    Create tables, files, databases and datadictionaries.

    Specify the storage structure of each tableon disk.

    Integrity constraints on various tables.

    Security and authorization information of

    each table. Specify the structure of each table.

    Overall design of the Database.

  • 8/8/2019 Concepts of Database

    21/70

    Data Manipulation Language (DML) A language that enables users to access or manipulate data

    (retrieve, insert, update, delete) as organized by a certain DataModel is called the Data Manipulation Language (DML).

    Data Manipulation is: retrieval of information from the database insertion of new information into the database deletion of information in the database

    modification of information in the database ADML is a language which enables users to access and manipulate

    data. The goal is to provide efficient human interaction with the system. There are two types ofDML:

    procedural: the user specifies whatdata is needed and how to get it

    nonprocedural: the user only specifies whatdata is needed Easier for user May not generate code as efficient as that produced by procedural

    languages

    A query language is a portion of a DML involving informationretrieval only. The terms DML and query language are often usedsynonymously.

  • 8/8/2019 Concepts of Database

    22/70

    Database Manager

    The database manageris a program module whichprovides the interface between the low-level data storedin the database and the application programs andqueries submitted to the system.

    Databases typically require lots of storage space(gigabytes). This must be stored on disks. Data is movedbetween disk and main memory (MM) as needed.

    The goal of the database system isto simplify and facilitate access to data. Performance isimportant. Views provide simplification.

  • 8/8/2019 Concepts of Database

    23/70

    So the database manager module is responsible for Interaction with the file manager: Storing raw data on disk

    using the file system usually provided by a conventionaloperating system. The database manager must translate

    DML statements into low-level file system commands (forstoring, retrieving and updating data in the database).

    Integrity enforcement: Checking that updates in thedatabase do not violate consistency constraints (e.g. nobank account balance below $25)

    Security enforcement: Ensuring that users only haveaccess to information they are permitted to see Backup and recovery: Detecting failures due to power

    failure, disk crash, software errors, etc., and restoring thedatabase to its state before the failure

    Concurrency control:P

    reserving data consistency whenthere are concurrent users.

    Some small database systems may miss some ofthese features, resulting in simpler databasemanagers. These features are necessary on larger

    systems.

  • 8/8/2019 Concepts of Database

    24/70

    Database Administrator

    The

    database a

    dministratorisa person having central control over data and

    programs accessing that data. Duties of thedatabase administrator include:

    Scheme definition: the creation of the originaldatabase scheme. This involves writing a set ofdefinitions in a DDL (data storage and definitionlanguage), compiled by the DDL compiler into a setof tables stored in the data dictionary.

    Storage structure and access methoddefinition: writing a set of definitions translated by

    the data storage and definition language compiler

    Database Administrator

  • 8/8/2019 Concepts of Database

    25/70

    Scheme and physical organization modification: writing a setof definitions used by the DDL compiler to generatemodifications to appropriate internal system tables (e.g. datadictionary). This is done rarely, but sometimes the databasescheme or physical organization must be modified.

    Granting of authorization fordata access: granting different

    types of authorization for data access to various users Integrity constraint specification: generating integrityconstraints. These are consulted by the database managermodule whenever updates occur.

    In case of small organization the role ofDBA isperformed by a single person and in case of largeorganizations there is a group ofDBA's who shareresponsibilities.

    Database Administrator

  • 8/8/2019 Concepts of Database

    26/70

    Database Designers

    They are responsible for identifying the data tobe stored in the database and for choosingappropriate structure to represent and store the

    data. It is the responsibility of database designers to

    communicate with all prospective of thedatabase users in order to understand their

    requirements so that they can create a designthat meets their requirements.

  • 8/8/2019 Concepts of Database

    27/70

    Application Programmers

    Application Programmers are responsible forwriting application programs that use the database.

    These programs could be written in GeneralPurpose Programming languages such asVisual Basic, Developer, C, FORTRAN, COBOLetc. to manipulate the database.

    These application programs operate on the datato perform various operations such as retaininginformation, creating new information, deletingor changing existing information.

  • 8/8/2019 Concepts of Database

    28/70

    End Users

    End Users are the people who interact with thedatabase through applications or utilities. Thevarious categories of end users are:

    Casual EndUsers - These Users occasionallyaccess the database but may need differentinformation each time. They use sophisticateddatabase Query language to specify theirrequests.

    For example: High level Managers who accessthe data weekly or biweekly.

  • 8/8/2019 Concepts of Database

    29/70

    End Users Native EndUsers - These users frequently query and

    update the database using standard types ofQueries.The operations that can be performed by this class ofusers are very limited and effect precise portion of thedatabase.

    For example: - Reservation clerks for airlines/hotelscheck availability for given request and makereservations. Also, persons using Automated TellerMachines (ATM's) fall under this category as he hasaccess to limited portion of the database.

    Standalone endUsers/On-line EndUsers - Thoseend Users who interact with the database directly via on-line terminal or indirectly through Menu or graphicsbased Interfaces.

    For example: - User of a text package, librarymanagement software that store variety of library data

    such as issue and return of books for fine purposes.

  • 8/8/2019 Concepts of Database

    30/70

    Data Abstraction

    The major purpose of a database systemis to provide users with an abstractview of the system.

    The system hides certain details of howdata is stored and created andmaintained

    Complexity should be hidden fromdatabase users.

  • 8/8/2019 Concepts of Database

    31/70

    Data Abstraction

    There are several levels of abstraction: Physical Level:

    How the data are stored. E.g. index, B-tree, hashing. Lowest level of abstraction. Complex low-level structures described in detail.

    Conceptual Level: Next highest level of abstraction. Describes whatdata are stored. Describes the relationships among data. Database administrator level.

    View Level:

    Highest level. Describespartof the database for a particular group of users. Can be many different views of a database. E.g. tellers in a bank get a view of customer accounts, but not of payroll

    data.

  • 8/8/2019 Concepts of Database

    32/70

    Data Abstraction

  • 8/8/2019 Concepts of Database

    33/70

    Data Independence

    The ability to modify a scheme definition in onelevel without affecting a scheme definition in a

    higher level is called data independence.

    There are two kinds:

    Physical data independence The ability to modify the physical scheme without causing

    application programs to be rewritten

    Modifications at this level are usually to improve performance

    Logical data independence The ability to modify the conceptual scheme without causing

    application programs to be rewritten

    Usually done when logical structure of database is altered

  • 8/8/2019 Concepts of Database

    34/70

    Data Models

    Data models are a collection ofconceptual tools for describing data, datarelationships, and data semantics anddata constraints. There are three differentgroups:

    Object-based Logical Models.

    Record-based Logical Models. Physical Data Models.

  • 8/8/2019 Concepts of Database

    35/70

    Record-based Logical Models Record-based logical models:

    describe data at the conceptual and viewlevels.

    are used to Specify overall logical structure of the

    database, and Provide a higher-level description of the

    implementation.

    Named so because the database isstructured in fixed-format records of severaltypes.

    Each record type defines a fixed number offields, or attributes.

  • 8/8/2019 Concepts of Database

    36/70

    Record-based Logical Models Each field is usually of a fixed length (this

    simplifies the implementation). Record-based models do not include a

    mechanism for direct representation of codein the database.

    Separate languages associated with themodel are used to express database queriesand updates.

    The three most widely-accepted models arethe relational, network, and hierarchical.

  • 8/8/2019 Concepts of Database

    37/70

    The Relational Model

    Data and relationships are representedby a collection oftables.

    Each table has a number of columnswith unique names, e.g. customer,account.

  • 8/8/2019 Concepts of Database

    38/70

  • 8/8/2019 Concepts of Database

    39/70

    The Network Model

    Data are represented by collections ofrecords.

    Relationships among data are representedby links.

    Organization is that of an arbitrary graph.

  • 8/8/2019 Concepts of Database

    40/70

  • 8/8/2019 Concepts of Database

    41/70

    The Hierarchical Model

    Similar to the network model.

    Organization of the records is as acollection oftrees, rather than arbitrarygraphs.

  • 8/8/2019 Concepts of Database

    42/70

  • 8/8/2019 Concepts of Database

    43/70

    The relational model does not use pointersor links, but relates records by the valuesthey contain. This allows a formalmathematical foundation to be defined

  • 8/8/2019 Concepts of Database

    44/70

  • 8/8/2019 Concepts of Database

    45/70

  • 8/8/2019 Concepts of Database

    46/70

  • 8/8/2019 Concepts of Database

    47/70

  • 8/8/2019 Concepts of Database

    48/70

  • 8/8/2019 Concepts of Database

    49/70

  • 8/8/2019 Concepts of Database

    50/70

  • 8/8/2019 Concepts of Database

    51/70

  • 8/8/2019 Concepts of Database

    52/70

  • 8/8/2019 Concepts of Database

    53/70

  • 8/8/2019 Concepts of Database

    54/70

  • 8/8/2019 Concepts of Database

    55/70

  • 8/8/2019 Concepts of Database

    56/70

  • 8/8/2019 Concepts of Database

    57/70

  • 8/8/2019 Concepts of Database

    58/70

  • 8/8/2019 Concepts of Database

    59/70

  • 8/8/2019 Concepts of Database

    60/70

  • 8/8/2019 Concepts of Database

    61/70

  • 8/8/2019 Concepts of Database

    62/70

  • 8/8/2019 Concepts of Database

    63/70

  • 8/8/2019 Concepts of Database

    64/70

  • 8/8/2019 Concepts of Database

    65/70

  • 8/8/2019 Concepts of Database

    66/70

  • 8/8/2019 Concepts of Database

    67/70

  • 8/8/2019 Concepts of Database

    68/70

  • 8/8/2019 Concepts of Database

    69/70

  • 8/8/2019 Concepts of Database

    70/70