15
Informatik f¨ ur ¨ Okonomen II Fall 2010 Database Systems Introduction SL01 Database Systems (5 weeks, Prof. Dr. M. B¨ ohlen) Software Engineering (5 weeks, Prof. Dr. M. Glinz) Security (3 weeks, Prof. Dr. B. Stiller) Inf4Oec10, SL01 1/58 M. B¨ohlen, ifi@uzh Course Organization Lectures take place in KOH-B-10 Time: Thursday 10:15 - 12:00 Web page: https://www.csg.uzh.ch/teaching/hs10/infooekII Podcasts will be available (a few days after the lectures) Assessment: successful completion of final exam Exercises are not considered for grade (but they help you to prepare for the final exam) Exam: 20.1.2011, 10:15 - 12:00 Inf4Oec10, SL01 2/58 M. B¨ohlen, ifi@uzh Exercises Information also available on course web page 5 exercises 2 exercises in database systems (Amr Noureldin) 2 exercises in software engineering (Reinhard Stoiber) 1 exercise in security (Guilherme Machado) Download from web page Hand-in in groups is allowed No online hand-in After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. B¨ohlen, ifi@uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael B¨ ohlen Exercise 0 30.09.10 Michael B¨ ohlen 07.10.10 Michael B¨ ohlen Exercise 1 14.10.10 Michael B¨ ohlen Hand-in Exercise 1 21.10.10 Michael B¨ ohlen Exercise 2 28.10.10 Martin Glinz Hand-in Exercise 2 04.11.10 Martin Glinz Exercise 3 11.11.10 Martin Glinz Hand-in Exercise 3 18.11.10 Martin Glinz Exercise 4 25.11.10 Martin Glinz Hand-in Exercise 4 02.12.10 Burkhard Stiller Exercise 5 09.12.10 Burkhard Stiller Hand-in Exercise 5 16.12.10 Burkhard Stiller 23.12.10 Questions Inf4Oec10, SL01 4/58 M. B¨ohlen, ifi@uzh

I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Informatik fur Okonomen IIFall 2010

Database SystemsIntroduction

SL01

◮ Database Systems (5 weeks, Prof. Dr. M. Bohlen)

◮ Software Engineering (5 weeks, Prof. Dr. M. Glinz)

◮ Security (3 weeks, Prof. Dr. B. Stiller)

Inf4Oec10, SL01 1/58 M. Bohlen, ifi@uzh

Course Organization

◮ Lectures take place in KOH-B-10

◮ Time: Thursday 10:15 - 12:00

◮ Web page: https://www.csg.uzh.ch/teaching/hs10/infooekII

◮ Podcasts will be available (a few days after the lectures)

◮ Assessment: successful completion of final exam

◮ Exercises are not considered for grade (but they help you to preparefor the final exam)

◮ Exam: 20.1.2011, 10:15 - 12:00

Inf4Oec10, SL01 2/58 M. Bohlen, ifi@uzh

Exercises

◮ Information also available on course web page

◮ 5 exercises◮ 2 exercises in database systems (Amr Noureldin)◮ 2 exercises in software engineering (Reinhard Stoiber)◮ 1 exercise in security (Guilherme Machado)

◮ Download from web page

◮ Hand-in in groups is allowed

◮ No online hand-in

◮ After lecture hand-in of printed hard copy

Inf4Oec10, SL01 3/58 M. Bohlen, ifi@uzh

Timetable

Date Lecture Exercise (tentative)

23.09.10 Michael Bohlen Exercise 0

30.09.10 Michael Bohlen

07.10.10 Michael Bohlen Exercise 1

14.10.10 Michael Bohlen Hand-in Exercise 1

21.10.10 Michael Bohlen Exercise 2

28.10.10 Martin Glinz Hand-in Exercise 2

04.11.10 Martin Glinz Exercise 3

11.11.10 Martin Glinz Hand-in Exercise 3

18.11.10 Martin Glinz Exercise 4

25.11.10 Martin Glinz Hand-in Exercise 4

02.12.10 Burkhard Stiller Exercise 5

09.12.10 Burkhard Stiller Hand-in Exercise 5

16.12.10 Burkhard Stiller

23.12.10 Questions

Inf4Oec10, SL01 4/58 M. Bohlen, ifi@uzh

Page 2: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Office Hours

◮ Take place every week

◮ Office hours can be used for questions about lectures and exercises

◮ Location: RAI-D-017◮ Dates

◮ Monday 12:15 - 13:00 (Antonio Kumin)◮ Tuesday 17:15 - 18:00 (Robert Dewer, Hannes Tresch)◮ Thursday 12:30 - 13:15 (Francisco de Freitas, Jens Birchler)

Inf4Oec10, SL01 5/58 M. Bohlen, ifi@uzh

The Database System Module

◮ The textbook is Fundamentals ofDatabase Systems by Elmasri andNavathe.

◮ Doing the exercises is crucial for thedatabase part. It is the best preparationfor the exam.

◮ What is important◮ Understand the main properties of database systems.◮ Being able to be precise about key concepts of database systems.◮ Being able to apply your knowledge on relevant examples.

Inf4Oec10, SL01 6/58 M. Bohlen, ifi@uzh

The Database System Module

1. Introduction to Database Systems◮ Field, terminology, database system, schema, instance, functionality,

architecture◮ chapters 1 and 2 in Elmasri and Navathe, 4th edition

2. Relational algebra◮ The relational model, relational algebra◮ chapter 6 in Elmasri and Navathe, 4th edition

3. SQL◮ Data definition language, data manipulation language◮ chapter 8 in Elmasri and Navathe, 4th edition

4. Entity relationship model◮ The design process, the entity-relationship model, entity-relationship

to relational model mapping◮ chapters 3 and 7 in Elmasri and Navathe, 4th edition

Inf4Oec10, SL01 7/58 M. Bohlen, ifi@uzh

I hear and forget

I learn and remember

I do and understand

Inf4Oec10, SL01 8/58 M. Bohlen, ifi@uzh

Page 3: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Introduction to Database Systems

◮ The database field

◮ Database and database users

◮ Basic database terminology

◮ Main characteristics of the database approach

◮ Database languages and interfaces

◮ Database system architectures

◮ History of database systems

Inf4Oec10, SL01 9/58 M. Bohlen, ifi@uzh

The Database Field/1

◮ Journal Publications◮ ACM Transaction on Database System (TODS)◮ The VLDB Journal (VLDBJ)◮ IEEE Transactions on Knowledge and Data Engineering (TKDE)◮ Information Systems (IS)

◮ Conference Publications◮ SIGMOD◮ VLDB◮ ICDE◮ EDBT

◮ DBLP Bibliography (Michael Ley, Uni Trier, Germany)◮ http://dblp.uni-trier.de/db/

◮ DBWorld mailing list◮ http://www.cs.wisc.edu/dbworld/

Inf4Oec10, SL01 10/58 M. Bohlen, ifi@uzh

The Database Field/2

Inf4Oec10, SL01 11/58 M. Bohlen, ifi@uzh

The Database Database Field/3

◮ Commercial Products◮ Oracle◮ DB2 (IBM)◮ Microsoft SQL Server◮ Sybase◮ Ingres◮ Informix◮ PC “DBMSs”: Paradox, Access, ...◮ ...

◮ Open Source Products◮ PostgreSQL◮ MySQL◮ MonetDB◮ ...

We will use MySQL for this course.

Inf4Oec10, SL01 12/58 M. Bohlen, ifi@uzh

Page 4: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Typical Activities of Database People

◮ Data modeling

◮ Handling large volumes of complex data

◮ Distributed databases

◮ Design of migration strategies

◮ User interface design

◮ Development of algorithms

◮ Design of languages◮ New data models and systems

◮ XML/semi-structured databases◮ Stream data processing◮ Temporal and spatial databases◮ GIS systems

Inf4Oec10, SL01 13/58 M. Bohlen, ifi@uzh

Basic Definitions/1

About, data, information, and knowledge:

◮ Data are facts that can be recorded:◮ book(Lord of the Rings, 3, 10)

◮ Information = data + meaning◮ book:

◮ title = Lord of the rings,◮ volume nr = 3,◮ price in USD = 10

◮ Knowledge = information + application

Inf4Oec10, SL01 14/58 M. Bohlen, ifi@uzh

Basic Definitions/2

◮ Mini-world: The part of the real world we are interested in

◮ Data: Known facts about the mini-world that can be recorded

◮ Database (DB): A collection of related data

◮ Database Management System (DBMS): A software package tofacilitate the creation/maintenance of databases

◮ Database System (DBS): DB + DBMS

◮ Meta Data: Information about the structure of the DB.◮ Meta data is organized as a DB itself.

Inf4Oec10, SL01 15/58 M. Bohlen, ifi@uzh

Basic Definitions/3

Inf4Oec10, SL01 16/58 M. Bohlen, ifi@uzh

Page 5: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Basic Definitions/4

◮ A DBMS provides two kind of languages

◮ A data definition language (DDL) for specifying the databaseschema

◮ the database schema is stored in the data dictionary◮ the content of data dictionary is called metadata

◮ A data manipulation language (DML) for updating and queryingdatabases, i.e.,

◮ retrieval of information◮ insertion of new information◮ deletion of information◮ modification of information

◮ The standard language for database systems is SQL; “Intergalacticdata speak” [Michael Stonebraker].

◮ SQL offers a DDL and DML.

Inf4Oec10, SL01 17/58 M. Bohlen, ifi@uzh

Database Applications

◮ Traditional Applications◮ Numeric and Textual Databases

◮ More Recent Applications:◮ Multimedia Databases◮ Geographic Information Systems (GIS)◮ Data Warehouses◮ Real-time and Active Databases◮ Many other applications

◮ Examples:◮ Bank (accounts)◮ Stores (inventory, sales)◮ Reservation systems◮ University (students, courses, rooms)◮ online sales (amazon.com)◮ online newspapers (nzz.ch)

Inf4Oec10, SL01 18/58 M. Bohlen, ifi@uzh

Typical DBMS Functionality/1

◮ Define a particular database in terms of its data types, structures,and constraints

◮ Construct or load the initial database contents on a secondarystorage medium

◮ Manipulating the database:◮ Retrieval: Querying, generating reports◮ Modification: Insertions, deletions and updates to its content◮ Accessing the database through Web applications

◮ Sharing by a set of concurrent users and application programswhile, at the same time, keeping all data valid and consistent

Inf4Oec10, SL01 19/58 M. Bohlen, ifi@uzh

Typical DBMS Functionality/2

◮ Other features of DBMSs:◮ Protection or security measures to prevent unauthorized access

◮ Active processing to take internal actions on data

◮ Presentation and visualization of data

◮ Maintaining the database and associated programs over the lifetimeof the database application (called database, software, and systemmaintenance)

Inf4Oec10, SL01 20/58 M. Bohlen, ifi@uzh

Page 6: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Database Users/1

Database users have very different tasks. There are those who use andcontrol the database content, and those who design, develop andmaintain database applications.

◮ Database administrators:◮ Responsible for authorizing access to the database, for coordinating

and monitoring its use, acquiring software and hardware resources,controlling its use and monitoring efficiency of operations.

◮ Database Designers:◮ Responsible to define the content, the structure, the constraints, and

functions or transactions against the database. They mustcommunicate with the end-users and understand their needs.

Inf4Oec10, SL01 21/58 M. Bohlen, ifi@uzh

Database Users/2

◮ End-users: They use the data for queries, reports and some of themupdate the database content. End-users can be categorized into:

◮ Casual: access database occasionally when needed◮ Naıve: they make up a large section of the end-user population.

◮ They use previously well-defined functions in the form of “cannedtransactions” against the database.

◮ Examples are bank-tellers or reservation clerks.

◮ Sophisticated:◮ These include business analysts, scientists, engineers, others

thoroughly familiar with the system capabilities.◮ Many use tools in the form of software packages that work closely

with the stored database.

◮ Stand-alone:◮ Mostly maintain personal databases using ready-to-use packaged

applications.◮ An example is a tax program user that creates its own internal

database or a user that maintains an address book

Inf4Oec10, SL01 22/58 M. Bohlen, ifi@uzh

Data Models

◮ Data Model:◮ A set of concepts to describe the structure of a database, the

operations for manipulating these structures, and certainconstraints that the database should obey.

◮ Data Model Structure and Constraints:◮ Different constructs are used to define the database structure◮ Constructs typically include elements (and their data types) as well

as groups of elements (e.g., entity, record, table), and relationshipsamong such groups

◮ Constraints specify some restrictions on valid data; these constraintsmust be enforced at all times

◮ Data Model Operations◮ These operations are used for specifying database retrievals and

updates by referring to the constructs of the data model.◮ Operations on the data model may include basic model operations

(e.g. generic insert, delete, update) and user-defined operations (e.g.compute student gpa, update inventory)

Inf4Oec10, SL01 23/58 M. Bohlen, ifi@uzh

Categories of Data Models

◮ Conceptual (high-level, semantic) data models:◮ Provide concepts that are close to the way many users perceive data.

(Also called entity-based or object-based data models.)

◮ Physical (low-level, internal) data models:◮ Provide concepts that describe details of how data is stored in the

computer. These are usually specified in an ad-hoc manner throughDBMS design and administration manuals

◮ Implementation (representational) data models:◮ Provide concepts that fall between the above two, used by many

commercial DBMS implementations (e.g. relational data models usedin many commercial systems).

Inf4Oec10, SL01 24/58 M. Bohlen, ifi@uzh

Page 7: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Database Schema

◮ Database Schema:◮ The description of a database.◮ Includes descriptions of the database structure, data types, and the

constraints on the database.

◮ Schema Diagram:◮ An illustrative display of (most aspects of) a database schema.

◮ Schema Construct:◮ A component of the schema or an object within the schema, e.g.,

STUDENT, COURSE.

◮ The database schema changes very infrequently.

◮ Schema is also called intension.

Inf4Oec10, SL01 25/58 M. Bohlen, ifi@uzh

Example of a Database Schema

STUDENTName StudNr Class Major

COURSECourseName CourseNr CreditHours Department

PREREQUISITECourseNr PrerequisiteNr

SECTIONSectionID CourseNr Semester Year Instructor

GRADE REPORTStudNr SectionId Grade

Inf4Oec10, SL01 26/58 M. Bohlen, ifi@uzh

Database Instance

◮ Database Instance:◮ The actual data stored in a database at a particular moment in time.

This includes the collection of all the data in the database.◮ Also called database state (or occurrence or snapshot).◮ The term instance is also applied to individual database components,

e.g., record instance, table instance, entity instance

◮ Initial Database Instance: Refers to the database instance that isinitially loaded into the system.

◮ Valid Database Instance: An instance that satisfies the structureand constraints of the database.

◮ The database instance changes every time the database is updated.

◮ Instance is also called extension.

Inf4Oec10, SL01 27/58 M. Bohlen, ifi@uzh

Example of a Database InstanceCOURSE

CourseName CourseNr CreditHours Department

Intro to Computer Science CS1310 4 CSData Structures CS3320 4 CS

Discrete Mathematics MATH2410 3 MATHDatabases CS3360 3 CS

SECTIONSectionID CourseNr Semester Year Instructor

85 MATH2410 Fall 04 King92 CS1310 Fall 04 Anderson102 CS3320 Spring 05 Knuth112 MATH2410 Fall 05 Chang119 CS1310 Fall 05 Anderson135 CS3380 Fall 05 Stone

PREREQUISITECourseNr PrerequisiteNr

CS3380 CS3320CS3380 MATH2410CS3320 CS1310

GRADE REPORTStudNr SectionId Grade

17 112 B17 119 C8 85 A8 92 A8 102 B8 135 A

Inf4Oec10, SL01 28/58 M. Bohlen, ifi@uzh

Page 8: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

The ANSI/SPARC Three Schema Architecture/1

◮ Proposed to support DBMS characteristics of:◮ Data independence◮ Multiple views of the data

◮ Not explicitly used in commercial DBMS products, but has beenuseful in explaining database system organization

◮ 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 structureand 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 userviews.

◮ Usually uses the same data model as the conceptual schema.

Inf4Oec10, SL01 29/58 M. Bohlen, ifi@uzh

The ANSI/SPARC Three Schema Architecture/2

◮ Mappings among schema levels are needed to transform requestsand data.

◮ Programs refer to an external schema, and are mapped by the DBMSto the internal schema for execution.

◮ Data extracted from the internal DBMS level is reformatted to matchthe user’s external view (e.g., formatting the results of an SQL queryfor display in a Web page)

Inf4Oec10, SL01 30/58 M. Bohlen, ifi@uzh

The ANSI/SPARC Three Schema Architecture/3

Inf4Oec10, SL01 31/58 M. Bohlen, ifi@uzh

Data Independence

◮ Logical Data Independence:◮ The capacity to change the conceptual schema without having to

change the external schemas and their associated applicationprograms.

◮ Physical Data Independence:◮ The capacity to change the internal schema without having to change

the conceptual schema.◮ For example, the internal schema may be changed when certain file

structures are reorganized or new indexes are created to improvedatabase performance

◮ When a schema at a lower level is changed, only the mappingsbetween this schema and higher-level schemas need to be changedin a DBMS that fully supports data independence.

◮ The higher-level schemas themselves are unchanged.◮ Hence, the application programs need not be changed since they refer

to the external schemas.

Inf4Oec10, SL01 32/58 M. Bohlen, ifi@uzh

Page 9: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Main Characteristics of Database Approach/1

◮ Data Abstraction:◮ A data model is used to hide storage details and present the users

with a conceptual view of the database.◮ Programs refer to the data model constructs rather than data storage

details

◮ Support of multiple views of the data:◮ Each user may see a different view of the database, which describes

only the data of interest to that user.

Inf4Oec10, SL01 33/58 M. Bohlen, ifi@uzh

Main Characteristics of Database Approach/2

◮ Self-describing nature of a database system:◮ A DBMS catalog stores the description of a particular database (e.g.

data types, data structures, and constraints)◮ The description is called metadata.◮ This allows the DBMS software to work with different database

applications.

◮ Insulation between programs and data:◮ Called data independence.◮ Allows changing data structures and storage organization without

having to change the DBMS access programs.

Inf4Oec10, SL01 34/58 M. Bohlen, ifi@uzh

Main Characteristics of Database Approach/3

Example of a DBMS catalog (just the idea; oversimplified):

RELATIONSRelationName NrOfColumns

STUDENT 4

COURSE 4

SECTION 5

GRADE REPORT 3

PRERQUISITE 2

COLUMNSColumnName DataType BelongsToRelation

Name Character(30) STUDENT

StudentNr CHARACTER(4) STUDENT

Class INTEGER(1) STUDENT

... ... ...

◮ PostgreSQL 8.3.9: 74 objects in the system catalog

◮ Oracle 10.2: 1821 objects in the system catalog

Inf4Oec10, SL01 35/58 M. Bohlen, ifi@uzh

Main Characteristics of Database Approach/4

◮ Sharing of data and multi-user transaction processing:◮ Allowing a set of concurrent users to retrieve from and to update the

database.◮ Concurrency control within the DBMS guarantees that each

transaction is correctly executed or aborted◮ Recovery subsystem ensures each completed transaction has its effect

permanently recorded in the database◮ OLTP (Online Transaction Processing) is a major part of database

applications. This allows hundreds of concurrent transactions toexecute per second.

Inf4Oec10, SL01 36/58 M. Bohlen, ifi@uzh

Page 10: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

DBMS Languages/1

◮ A DBMS offers a data definition language (DDL) and a datamanipulation language (DML)

◮ We distinguish between◮ High level or declarative languages◮ Low level or procedural languages

◮ High level or declarative language:◮ For example, the SQL relational language◮ Are set-oriented and specify what data to retrieve rather than how to

retrieve it.◮ Also called non-procedural languages.

◮ Low level or procedural language:◮ Retrieve data one record at a time;◮ Constructs such as looping are needed to retrieve multiple records,

along with positioning pointers.

Inf4Oec10, SL01 37/58 M. Bohlen, ifi@uzh

DBMS Languages/2

◮ Data Definition Language (DDL):◮ Used by the DBA and database designers to specify the conceptual

schema of a database.◮ In many DBMSs, the DDL is also used to define internal and external

schemas (views).◮ In some DBMSs, separate storage definition language (SDL) and view

definition language (VDL) are used to define internal and externalschemas.

◮ SDL is typically realized via DBMS commands provided to the DBAand database designers

Inf4Oec10, SL01 38/58 M. Bohlen, ifi@uzh

DBMS Languages/3

◮ Data Manipulation Language (DML):◮ Used to specify database retrievals and updates◮ DML commands can be embedded in a general-purpose programming

language, such as COBOL, C, C++, or Java.◮ A library of functions can also be provided to access the DBMS from

a programming language

◮ Alternatively, stand-alone DML commands can be issued directly.

Inf4Oec10, SL01 39/58 M. Bohlen, ifi@uzh

DBMS Interfaces/1

◮ Stand-alone query language interfaces◮ Example: Entering SQL queries at the DBMS interactive SQL

interface (e.g. psql in PostgreSQL, sqlplus in Oracle)

◮ Programmer interfaces for embedding DML in programminglanguages

◮ User-friendly interfaces◮ Menu-based, forms-based, graphics-based, etc.

◮ Speech as Input and Output

◮ Web Browser as an interface

◮ Parametric interfaces, e.g., bank tellers using function keys.◮ Interfaces for the DBA:

◮ Creating user accounts, granting authorizations◮ Setting system parameters◮ Changing schemas or access paths

Inf4Oec10, SL01 40/58 M. Bohlen, ifi@uzh

Page 11: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

DBMS Interfaces/2

◮ There are various database system utilities to perform certainfunctions such as:

◮ Loading data stored in files into a database. Includes data conversiontools.

◮ Backing up the database periodically on tape.◮ Reorganizing database file structures.◮ Report generation utilities.◮ Performance monitoring utilities.◮ Other functions, such as sorting, user monitoring, data compression,

etc.

Inf4Oec10, SL01 41/58 M. Bohlen, ifi@uzh

Components of the DBS Architecture

Inf4Oec10, SL01 42/58 M. Bohlen, ifi@uzh

1-tier Architecture/1

◮ Centralized DBMS:◮ Combines everything (DBMS software, hardware, application

programs, and user interface processing software) into a single system.◮ Users can still connect through a remote terminal◮ All processing is done at a centralized site.◮ DBMS must do everything (e.g., support for interfaces, terminals,

connections, ...)◮ The DBMS gets huge and cumbersome

Inf4Oec10, SL01 43/58 M. Bohlen, ifi@uzh

1-tier Architecture/2

Inf4Oec10, SL01 44/58 M. Bohlen, ifi@uzh

Page 12: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

2-tier Architecture/1

◮ Specialized Servers with Specialized functions◮ Print server◮ File server◮ DBMS server◮ Web server◮ Email server

◮ Clients can access the specialized servers as needed

Inf4Oec10, SL01 45/58 M. Bohlen, ifi@uzh

2-tier Architecture/2

◮ Clients:◮ Provide appropriate interfaces through a client software module to

access and utilize the various server resources.◮ Clients may be diskless machines or PCs or Workstations with disks

with only the client software installed.◮ Connected to the servers via some form of a network. (local area

network, wireless network, etc.)

◮ DBMS Server:◮ Provides database query and transaction services to the clients◮ Relational DBMS servers are often called SQL servers, query servers,

or transaction servers◮ Applications running on clients utilize an application program

interface (API) to access server databases via standard interfaces:◮ ODBC: Open Database Connectivity standard◮ JDBC: for Java programming access

◮ Client and server must install appropriate client module and servermodule software for ODBC or JDBC

Inf4Oec10, SL01 46/58 M. Bohlen, ifi@uzh

3-tier Architecture/1

◮ Common for web applications◮ Intermediate layer called application server or web server:

◮ Stores the web connectivity software and the business logic part ofthe application used to access the corresponding data from thedatabase server

◮ Acts like a conduit for sending partially processed data between thedatabase server and the client.

◮ Three-tier architecture can enhance security:◮ Database server only accessible via middle tier◮ Clients cannot directly access database server

Inf4Oec10, SL01 47/58 M. Bohlen, ifi@uzh

3-tier Architecture/2

Inf4Oec10, SL01 48/58 M. Bohlen, ifi@uzh

Page 13: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

History of Data Models/1

◮ Network Model

◮ Hierarchical Model

◮ Relational Model

◮ Object-oriented Data Models

◮ Object-Relational Models

Inf4Oec10, SL01 49/58 M. Bohlen, ifi@uzh

History of Data Models/2

◮ Network Model:◮ The first network DBMS was implemented by Honeywell in 1964-65

(IDS System).◮ Adopted heavily due to the support by CODASYL (Conference on

Data Systems Languages) (CODASYL - DBTG report of 1971).

◮ Advantages:◮ The network model is able to model complex relationships.◮ Can handle most situations for modeling using record types and

relationship types.◮ Language is navigational; uses constructs like FIND, FIND member,

FIND owner, FIND NEXT within set, GET, etc.◮ Programmers can do optimal navigation through the database.

◮ Disadvantages:◮ Navigational and procedural nature of processing◮ Database contains a complex array of pointers that thread through a

set of records.◮ Little scope for automated query optimization

Inf4Oec10, SL01 50/58 M. Bohlen, ifi@uzh

History of Data Models/3

◮ Hierarchical Data Model:◮ Initially implemented in a joint effort by IBM and North American

Rockwell around 1965. Resulted in the IMS family of systems.◮ IBM’s IMS product had (and still has) a very large customer base

worldwide◮ Hierarchical model was formalized based on the IMS system◮ Other systems based on this model: System 2k (SAS inc.)

◮ Advantages:◮ Simple to construct and operate◮ Corresponds to a number of natural hierarchically organized domains,

e.g., organization chart◮ Language is simple; Uses constructs like GET, GET UNIQUE, GET

NEXT, GET NEXT WITHIN PARENT, etc.

◮ Disadvantages:◮ Navigational and procedural nature of processing◮ Database is visualized as a linear arrangement of records◮ Little scope for ”query optimization”

Inf4Oec10, SL01 51/58 M. Bohlen, ifi@uzh

History of Data Models/4

◮ Relational Model:◮ Proposed in 1970 by E.F. Codd (IBM)◮ First commercial system in 1981-82.◮ Now in several commercial products (e.g. DB2, ORACLE, MS SQL

Server, SYBASE, INFORMIX).◮ Several free open source implementations, e.g. MySQL, PostgreSQL◮ Currently most dominant for developing database applications.◮ SQL relational standards: SQL-89 (SQL1), SQL-92 (SQL2), SQL-99,

SQL3, . . .

Inf4Oec10, SL01 52/58 M. Bohlen, ifi@uzh

Page 14: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

History of Data Models/5

◮ Object-oriented Data Models:◮ Several models have been proposed for implementing in a database

system.◮ One set comprises models of persistent O-O Programming Languages

such as C++ (e.g., in OBJECTSTORE or VERSANT), and Smalltalk(e.g., in GEMSTONE).

◮ Additionally, systems like O2, ORION, IRIS (HP).◮ Object Database Standard: ODMG-93, ODMG-version 2.0,

ODMG-version 3.0.

◮ Object-Relational Models:◮ Most recent trend. Started with Informix Universal Server.◮ Relational systems incorporate concepts from object databases

leading to object-relational systems.◮ Exemplified in the latest versions of Oracle-10i, DB2, and SQL Server

and other DBMSs.◮ Standards included in SQL-99 and expected to be enhanced in future

SQL standards.

Inf4Oec10, SL01 53/58 M. Bohlen, ifi@uzh

Advantages of Using a DBMS/1

◮ Controlling redundancy in data storage

◮ Restricting unauthorized access to data.

◮ Providing persistent storage for program objects

◮ Providing storage structures (e.g. indexes) for efficient queryprocessing

◮ Providing backup and recovery services.

◮ Providing multiple interfaces to different classes of users.

◮ Representing complex relationships among data.

◮ Enforcing integrity constraints on the database (= good dataquality).

◮ Drawing inferences and actions from the stored data using deductiveand active rules

Inf4Oec10, SL01 54/58 M. Bohlen, ifi@uzh

Advantages of Using a DBMS/2

◮ Potential for enforcing standards:◮ This is very crucial for the success of database applications in large

organizations. Standards refer to data item names, display formats,screens, report structures, meta-data (description of data), Web pagelayouts, etc.

◮ Reduced application development time:◮ Incremental time to add each new application is reduced.

◮ Flexibility to change data structures:◮ Database structure may evolve as new requirements are defined.

◮ Availability of current information:◮ Extremely important for on-line transaction systems such as airline,

hotel, car reservations.

◮ Economies of scale:◮ Wasteful overlap of resources and personnel can be avoided by

consolidating data and applications across departments.

Inf4Oec10, SL01 55/58 M. Bohlen, ifi@uzh

When to Not Use a DBMS

◮ Main inhibitors of using a DBMS:◮ High initial investment and possible need for additional hardware.◮ Overhead for providing generality, security, concurrency control,

recovery, and integrity functions.

◮ When a DBMS may be unnecessary:◮ If the database and applications are simple, well defined, and not

expected to change.◮ If there are stringent real-time requirements that may not be met

because of DBMS overhead.◮ If access to data by multiple users is not required.

◮ When no DBMS may suffice:◮ If the database system is not able to handle the complexity of data

because of modeling limitations◮ If the database users need special operations not supported by the

DBMS.

Inf4Oec10, SL01 56/58 M. Bohlen, ifi@uzh

Page 15: I Database Systems Introduction I · I After lecture hand-in of printed hard copy Inf4Oec10, SL01 3/58 M. Bo hlen, i @uzh Timetable Date Lecture Exercise (tentative) 23.09.10 Michael

Summary/1

◮ Companies (start to) use database systems because there is no othersolution to manage the data.

◮ The data is often by far the biggest asset of a company.

◮ Database systems allow to control the redundancy of the data.◮ Database systems provide data independence

◮ the access to the data is done logically and never relies on thephysical data organization

◮ this allows to change the storage organization, update HW, updateSW, etc

◮ SQL is the standard database query language.

Inf4Oec10, SL01 57/58 M. Bohlen, ifi@uzh

Summary/2

◮ Data Models◮ data model = structures + operations + constraints

◮ Schemas and Instances◮ schema = intension; changes infrequently◮ relation instance = relation = extension; changes often

◮ Three-Schema Architecture◮ external, conceptual, and internal schema

◮ Data Independence◮ reorganize internal schema without changing conceptual schema

◮ DBMS Languages and Interfaces◮ stand-alone command line interfaces: psql, sqlplus, ...◮ programming interfaces: ODBC, JDBC◮ database development tools: pgadmin, SQL developer

◮ History of Data Models◮ network, hierarchical, relational, object-oriented, object-relational

Inf4Oec10, SL01 58/58 M. Bohlen, ifi@uzh