dbms lecture 01

Upload: rosan-benosa

Post on 04-Jun-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 DBMS Lecture 01

    1/37

    ELE320_ENGR. J. SADOL 1

    ELE320 - Elective 1

    Database Management Systems

    Overview

    Engr. Joy N. Sadol

  • 8/13/2019 DBMS Lecture 01

    2/37

    2

    Data VS InformationData is a collection of raw facts

    Examples:

    customer name, graphics, images,address, sound, and video segments,telephone number

    Data is not information

    Data without context is useless

  • 8/13/2019 DBMS Lecture 01

    3/37

    3

    Data VS Information The termsdata andinformation are

    closely related, and in fact are often

    used interchangeably.

    Informationis data that has been

    processed in such a way that it can

    increase the knowledge of the personwho uses it.

    Informationisdata that is organized

    and meaningful.

  • 8/13/2019 DBMS Lecture 01

    4/37

    4

    Data VS Information

    Data + Interpretation -

    >Information/KnowledgeExample:

    Baker, Kenneth D. 2001-12345Doyle, Joan E. 1999-67890Finkle, Clive R. 2000-00001Lewis, Clark C. 1998-01023

  • 8/13/2019 DBMS Lecture 01

    5/37

    5

    Data VS InformationConverting data to information (by

    context)Class ListCourse: Filedat Trimester: 1st 01-02

    Section: S33

    Name Student Number Major GPA

    Baker, Kenneth D. 2001-12345 SSE 3.5

    Doyle, Joan E. 1999-67890 COE 3.0

    Finkle, Clive R. 2000-00001 SSE 2.5Lewis, Clark C. 1998-01023 CNE 3.5

  • 8/13/2019 DBMS Lecture 01

    6/37

    6

    Data VS InformationConverting data to information (summarized)Percent of Enrollment by Major (200X)

    SSE 35%

    COE 30%

    CNE 35%

    Data is a very powerful asset!

    Steps in converting Data

    to Information

    Acquisition

    Storage

    Manipulation

    Retrieval

    Distribution

  • 8/13/2019 DBMS Lecture 01

    7/37

    7

    Programs VS Systems Program - a set of step-by-step

    instructions that directs a computer to

    perform specific tasks and producecertain results.

    Examples:

    Sorting, adding numbers, computation oftaxes, computation of deductions, MS

    Excel, MS Word, etc.

  • 8/13/2019 DBMS Lecture 01

    8/37

    8

    Programs VS Systems System - an organized set of related

    components established to perform a

    certain task.

    Examples:

    Payroll System, MS Office System,

    Inventory System, HRIS, DBMS etc.

  • 8/13/2019 DBMS Lecture 01

    9/37

    ELE320_ENGR. J. SADOL 9

    What is a Database?A collection of data, typically

    describing the activities of one or more

    related organizations It is a collection of data organized in a

    way that allows

    access retrieval use

  • 8/13/2019 DBMS Lecture 01

    10/37

    ELE320_ENGR. J. SADOL 10

    What is a Database? Databases play a critical role in almost all

    areas

    Banking:all transactions Airline:reservation, schedules

    Universities:registration, grades,

    Sales:customers, products, purchases

    Manufacturing:production, inventory, orders,supply chain

    Human resources:employee records, salaries,tax deductions

  • 8/13/2019 DBMS Lecture 01

    11/37

    ELE320_ENGR. J. SADOL 11

    What is a Database? A database can be of any sizeand of

    varying complexity.

    For example, the list of names and address offriends

    The book catalog of a large library may containhalf a million records

    A database of much greater size and complexity ismaintained by the government to keep track ofthe tax information filed by taxpayers.

  • 8/13/2019 DBMS Lecture 01

    12/37

    ELE320_ENGR. J. SADOL 12

    What is a Database?

    A schemais the definition of a database. It definesthe meaning of data.

    An instanceof a database is the collection of data inthe database at a particular point of time (snap-shot).

    For example, in the above, the schema is StudentName, ID, Age, Gender, Entrance Year, Grade. Theremaining rows in the table make up an instance ofthe database.

  • 8/13/2019 DBMS Lecture 01

    13/37

    ELE320_ENGR. J. SADOL 13

    What is a DBMS? DBMS Database Management System

    A DBMS is a collection of software programsto enable users to create, maintain andutilize a database.

    Database Management Systems (DBMS)Program or set of programs designed to control access to the database manage data resources

  • 8/13/2019 DBMS Lecture 01

    14/37

    ELE320_ENGR. J. SADOL 14

    What is a DBMS?

    DBMS

    Insert records

    Delete records

    Update records

    Query records

  • 8/13/2019 DBMS Lecture 01

    15/37

    ELE320_ENGR. J. SADOL 15

    What is a DBMS? Commercial DBMS

    Company Product

    Oracle Oracle 8i, 9i, 10g

    IBM DB2, Universal Server

    Microsoft Access, SQL Server

    Sybase Adaptive ServerInformix Dynamic Server

    1. Worlds 2nd largest softwarecompany

    2. CEO, Larry Ellison, worlds 2ndrichest

    Worlds 2nd largest after Informixacquisition

  • 8/13/2019 DBMS Lecture 01

    16/37

    ELE320_ENGR. J. SADOL 16

    What is a DBMS?

    Commercial DBMS

    Company Product

    Oracle Oracle 8i, 9i, 10g

    IBM DB2, Universal Server

    Microsoft Access, SQL Server

    Sybase Adaptive ServerInformix Dynamic Server

    Access comes with MS Office

    CEO, John Chen, grown up in HK

    Acquired by IBM in 2001

  • 8/13/2019 DBMS Lecture 01

    17/37

    ELE320_ENGR. J. SADOL 17

    Why do we need a DBMS?

    To reduce application development time

    Suppose we are given a collection ofraw files which occupy 500GB

    What are the drawbacks?

  • 8/13/2019 DBMS Lecture 01

    18/37

    ELE320_ENGR. J. SADOL 18

    Drawback of File System

    1. Data Redundancy and Inconsistency

    E.g., consider a bank application

    address of a customer in the file of saving-accountsand

    the file of checking-accounts

    A good design of DBMS can avoiddata redundancy and inconsistency.

  • 8/13/2019 DBMS Lecture 01

    19/37

    ELE320_ENGR. J. SADOL 19

    Drawback of File System

    2. Difficulty in accessing data

    Need to write a new program to carry out

    each new task

    It is easy to obtain data with DBMS

  • 8/13/2019 DBMS Lecture 01

    20/37

    ELE320_ENGR. J. SADOL 20

    Drawback of File System

    3. Integrity problems

    E.g., consider a bank application

    The balance cannot be below $1000

    The day of a month cannot exceed 31

    DBMS can check the integrityautomatically

  • 8/13/2019 DBMS Lecture 01

    21/37

    ELE320_ENGR. J. SADOL 21

    Drawback of File System

    4. Atomicity of updates

    E.g., consider a bank application

    We want to transfer $100 from account A toaccount B

    Steps:

    Step 1: We deduct $100 from account A

    Step 2:Then, we increment $100 in account B

    If the system crashes at Step 1, then Step 2cannot be executed

    DBMS makes sure that Step 1 and Step 2can be executed together even with acrash (We call the execution is atomic.)

  • 8/13/2019 DBMS Lecture 01

    22/37

    ELE320_ENGR. J.SADOL 22

    Drawback of File System

    5. Concurrent Access by multiple users Uncontrolled concurrent accesses can lead to inconsistencies

    E.g., consider a bank application

    There is an account shared by 2 customers A and B

    Customers A and B withdraw $1000 concurrently

    DBMS makes sure that the concurrentaccess cannot lead to this problem

    Read 5000Read 5000

    5000 - 1000

    Write 4000

    5000 - 1000

    Write 4000

    A B

  • 8/13/2019 DBMS Lecture 01

    23/37

    ELE320_ENGR. J. SADOL 23

    Drawback of File System

    6. Security Problems

    E.g., consider a bank application

    We do not want system programmers to havepermissions to read some data(e.g., Andy Laus saving account and

    Joey Yungs saving account)

    Need a lot of effort to re-write a programfor this permission system

    DBMS can enforce that different users havedifferent permissions to access differentparts of the data

  • 8/13/2019 DBMS Lecture 01

    24/37

    ELE320_ENGR. J. SADOL 24

    Advantages of DBMS

    With the use of DBMS, we have the followingadvantages

    Data independence Efficient data access

    Data integrity and security

    Data administration

    Concurrent access and crash recovery

    Overall:Reduced application developmenttime

  • 8/13/2019 DBMS Lecture 01

    25/37

    ELE320

    ENGR. J. SADOL 25

    Data Models

    A data model is a collection of tools or concepts fordescribing data, the meaning of data, data relationshipsand data constraints

    Object-based logical models

    Entity-Relationship Model (ER Model)

    id

    BorrowerCustomer Loan

    Customer-name

    Customer-street

    Customer-cityLoan-number amount

  • 8/13/2019 DBMS Lecture 01

    26/37

    ELE320_ENGR. J. SADOL 26

    Data Models

    Record-based Logical Models Relational Model

    Main concept: relation, basically a table with rows and columns.A column is also called a fieldor attribute

    Other models such as the Network Model, Hierarchical Model,

    object-oriented model, objected-relational modelWe will focus on the dominant Relational model.

    A description of data in terms of a data model is called a schema.

  • 8/13/2019 DBMS Lecture 01

    27/37

    ELE320_ENGR. J. SADOL 27

    Data Abstraction

    is the process by which data and programsare defined with a representation similar in

    form to its meaning (semantics), while hidingaway the implementation details.

    Abstraction tries to reduce and factor outdetails so that the programmer can focus on

    a few concepts at a time.

    It hides certain details of how data is storedand maintained

  • 8/13/2019 DBMS Lecture 01

    28/37

    Levels of Data Abstraction

    ELE320_ENGR. J. SADOL 28

  • 8/13/2019 DBMS Lecture 01

    29/37

    ELE320ENGR. J. SADOL 29

    Data Abstraction Conceptual Level

    Physical arrangement of records by an

    index tree D43389

    C73334 F89328

    A34455 C23444 E32399 G29021

  • 8/13/2019 DBMS Lecture 01

    30/37

    ELE320_ENGR. J. SADOL 30

    Data Abstraction

    A view when posting the grades to all students

    Views of a company with data on employees, departments,products, Payroll section:view on employees, departments, salaries Sales department:view on products, prices, sales, customers

    Purchasing department:view on parts, with pricing

  • 8/13/2019 DBMS Lecture 01

    31/37

    ELE320_ENGR. J. SADOL 31

    Data Independence

    Physical Data Independence

    Change of physical database schemas

    without change of conceptual databaseschemas or application programs

    Logical data independence

    Change of conceptual schemas withoutchange of external views

  • 8/13/2019 DBMS Lecture 01

    32/37

    ELE320_ENGR. J. SADOL 32

    What languages does thecomputer speak?

    Data Definition Language (DDL)

    A language that specifies data schemas

    Data Manipulation Language (DML) A language to facilitate the retrieval, update of

    data in the database

    For retrieval, we query the database with thequery language, which is part of the DML

  • 8/13/2019 DBMS Lecture 01

    33/37

    ELE320_ENGR. J. SADOL 33

    People who deal withdatabases

    Database Administrator (DBA):Person(s)who has central control over the database

    and is responsible for the following tasks Schema definition/modification

    Storage structure definition/modification

    Authorization of data access

    Integrity constraint specification Monitoring performance

    Responding to changes in requirements

  • 8/13/2019 DBMS Lecture 01

    34/37

    ELE320_ENGR. J. SADOL 34

    People who deal withdatabases

    Application Programmers Embed DML calls in program written in a host language (e.g.,

    Cobol, C, Java). (DML stands for data manipulation language)

    e.g., programs that generates payroll checks, transfer fundsbetween accounts

    Sophisticated users Form request in database query language

    Nave users Invokes one of the permanent application programs that

    have been written previously

    e.g. transfer transfer fund between accounts

  • 8/13/2019 DBMS Lecture 01

    35/37

    ELE320_ENGR. J. SADOL 35

    Structure of a DBMS

    Query Optimization and Execution

    Relational Operators

    Files and Access Methods

    Buffer Management

    Disk Space Management

  • 8/13/2019 DBMS Lecture 01

    36/37

    ELE320_ENGR. J. SADOL 36

    History

    The first generall purpose DBMS was designed byCharles Bachman at GE in early 1960s

    In 1970 Codd at IBM proposed a new data

    representation framework called the relational datamodel.

    The SQL query for relational databases, developed aspart of IBMs System R project, was standardized inthe late 1980s.

    The current standard, SQL-92, was adopted by ANSI(American National Standards Institute) and ISO(International Standards Organization).

  • 8/13/2019 DBMS Lecture 01

    37/37

    ELE320 ENGR J SADOL 37

    History

    In late 1980s and 1990s, several vendors (e.g., IBMsDB2, Oracle 8) have extended their systems with theability to store new data types such as images andtext.

    Specialized systems developed for datawarehouses, consolidating data from severaldatabases.Entering the Internat Age, a new markup languageXMLis proposed for data access through a Web

    browser.As more and more data are collected, companies arealso interested to mineuseful information from theirdata.