course introduction introduction to databases instructor

31
Course Introduction Introduction to Databases Instructor: Joe Bockhorst University of Wisconsin - Milwaukee

Upload: others

Post on 07-Apr-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Course Introduction Introduction to Databases Instructor

Course Introduction

Introduction to Databases

Instructor: Joe BockhorstUniversity of Wisconsin - Milwaukee

Page 2: Course Introduction Introduction to Databases Instructor

First Reading Assignment

• Chapters 1 and 2 (today and part of Thursday) Chapter 13 and handout

Page 3: Course Introduction Introduction to Databases Instructor

“There's a prayer each night that I always pray:Let the data guide me through every day”

Warren Zevon

Page 4: Course Introduction Introduction to Databases Instructor

Data is Ubiquitous

• Three classes of technological advances are changing our relationship with data:

• More storage space– allows us to keep more data

• Faster processor (and memory) speeds– allows us to access and process more data

• Different “sensors”– allows us to access new kinds of data

Page 5: Course Introduction Introduction to Databases Instructor

http://en.wikipedia.org/wiki/Hard_disk

Page 6: Course Introduction Introduction to Databases Instructor
Page 7: Course Introduction Introduction to Databases Instructor

Microarrays – An Example of aNew Sensing Technology

The color of each spot represents the activity level of a gene under some experimental condition

10 000s of spots on a single chip

A microarray

Page 8: Course Introduction Introduction to Databases Instructor

Other Data Examples

• Airline flight management system• Financial data• Commercial store (eg, WalMart) data• Department of Motor Vehicles• Surveillance video• University student records• Baseball results• Web sites• Medical records• ...

Page 9: Course Introduction Introduction to Databases Instructor

Effectively Data Management is Essential

• Organizations need their data to be an asset• Given:

the amount of data available to store&costs to manage data (hardware, software, labor)

• Ineffective policies can make an organization’s data a liability

Page 10: Course Introduction Introduction to Databases Instructor

Database Management System (DBMS)

• DBMS is:– A collection of software programs– General purpose

• DBMS enables users to:– Define DB– Construct DB– Change (or update) DB– Ask questions about the data in DB– Share DB

• DBMS maintains the integrity of DB

Page 11: Course Introduction Introduction to Databases Instructor

Some RDBM Systems

Commercial SystemsOracle ($$$$)DB2 (IBM) ($$$)SQL Server (Microsoft) ($$)

Open Source SystemsPostgreSQLMySQL

Source: International Data Corporation

Page 12: Course Introduction Introduction to Databases Instructor

Main Goals of this Course

• To understand how to use a DBMS– How to create DB, data models, SQL,...

• To understand how a DBMS works– Physical properties of disks and files, software to

manage reading and writing to disk, implementation of algorithms to answer user queries,...

Page 13: Course Introduction Introduction to Databases Instructor

catalog

Databases are self-describing: catalog describes the structure of the data stored in the DB

Page 14: Course Introduction Introduction to Databases Instructor

Example: Internet Movie Database (IMDB)

Page 15: Course Introduction Introduction to Databases Instructor

Building a DB:construct a conceptual model

movie person

acts in

director of

title release date name birthdate

rolerole type

• A conceptual model identifies entities and relationships

MN

N1

entity attribute relationship

Page 16: Course Introduction Introduction to Databases Instructor

Building a DB:Define DB Schema

• A schema describes DB using data modelsupported by DMBS (eg, relational model)

• RDBMS – DBMS that supports relational model

Rating DirectorTitleMID

BdayNamePID

RtypeRolePIDMID

MOVIE

PERSON

ACTS_IN

Page 17: Course Introduction Introduction to Databases Instructor

A Schema Diagram for “University” DB(from the textbook)

tables

columns

Page 18: Course Introduction Introduction to Databases Instructor

Building a DB:Describe Physical Data Model

• PDM indicates how data is organized on disk• Includes description of access paths or indexes

– Example: store “Movie” table with records ordered by MID and construct an index on the “Title” attribute

1 The Big Lebowski R 99

2 Star Wars PG 16

270 The Big Chill PG 3

The Big Chill

The Big Lebowski

File of records of the MOVIE tableIndex on Title column

Page 19: Course Introduction Introduction to Databases Instructor

Building a DB:Populate DB

PGRRating

...29Star Wars272The Big Lebowski1DirectorTitleMID

...7/13/42Harrison Ford212/4/49Jeff Daniels1BdayNamePID

...

CO_STARHan Solo22

STARThe Dude11

RtypeRolePIDMID

MOVIE

PERSONACTS_IN

Set initial records of the DB

Page 20: Course Introduction Introduction to Databases Instructor

Querying The Database

• Most RDBMS allow users to query the database using SQL (structured query language)

• Example: get cast of “The Big Lebowski”

SELECT Name, Role, RtypeFROM PERSON, ACTS_INWHERE MID = ‘1’ AND PERSON.PID == ACTS_IN.PID

Page 21: Course Introduction Introduction to Databases Instructor

Building the Application Program

Page 22: Course Introduction Introduction to Databases Instructor

Implementing Queries

• “Relational Algebra” is a mathematical way to describe operations on relational data

• SQL queries correspond to sequence of relational algebra operations– The previous query requires a join operation

between person and acts_in

• Query Optimization involves finding a good order to carry out operations

• Operator implementation

Page 23: Course Introduction Introduction to Databases Instructor

Managing Physical Data Storage

• RDBMS maintains database (and meta-data) on non-volatile storage (hard disks)

• Physical design impacts RDBMS performance

• Example: The time to answer a query such as What is the MID of “The Big Lebowski” can be greatly reduced if an index of Title column is maintained for the Movie table.

Page 24: Course Introduction Introduction to Databases Instructor

Maintaining Integrity of the Database

• Concurrent users– Multiple users may attempt to update simultaneously

• Security– Preventing unauthorized access

• System failures– If lightening strikes during an update the DB must

able to be recovered

Page 25: Course Introduction Introduction to Databases Instructor

Summary of Topics

• Conceptual modeling• Logical Modeling• Querying the DB• Building applications • Implementing Queries• Managing hardware• Maintaining Integrity

how to use DBMS

how a DBMS works

Page 26: Course Introduction Introduction to Databases Instructor

Control Abstraction

Query Optimization

Relational Operators

Files and Access Methods

Buffer Management

Disk Space Management

DB

Application Program

User

DBMS

Each layer need not know (or care) how other layers are implemented

Page 27: Course Introduction Introduction to Databases Instructor

Data Abstraction

Each layer need not know how other layers organize data

Page 28: Course Introduction Introduction to Databases Instructor

Why Use DBMS?

• Program Data Independence• Controlling redundancy• Providing backup and recovery• Efficient query processing• Others: see Section 1.6

Page 29: Course Introduction Introduction to Databases Instructor

Why not to use a DBMS?

• Consider custom software if DBMS overhead (cost, complexity, performance) is unnecessary– Example: single user of fixed dataset

Page 30: Course Introduction Introduction to Databases Instructor

Schemas and Instances

• A schema describes a database– RDBMS typically store schemas in the catalog

• The actual data in the DB at a particular time is the database state– The current set of all instances in the DB

Page 31: Course Introduction Introduction to Databases Instructor

People who work with DBMSs

• Database Administrator DBA– Maintains databases, DBMS and related software– [avg salary* $76k]

• Application Programmers– Software engineers (developers) that build software

solutions for end users that access DBMS• End Users

– Example: bank teller uses “canned transactions”• DBMS designers and implementers

– Example: Oracle developers

*source: payscale.com, 2007