Transcript Databases

Tomorrow’s Technology
and You 8/e
Chapter 7
Database Applications
© 2008 Prentice-Hall, Inc.
Slide 1
Tomorrow’s Technology and You 8/e
Chapter 7
Objectives
 Explain what a database is and describe its basic structure.
 Identify the kinds of problems that can be best solved with
database software.
 Describe different kinds of database software, from simple file
managers to complex relational databases.
© 2008 Prentice-Hall, Inc.
Slide 2
Tomorrow’s Technology and You 8/e
Chapter 7
Objectives (continued)
 Describe database operations for storing, sorting, updating,
querying, and summarizing information.
 Give examples of ways in which large, easily accessible
databases make lives safer or more convenient.
© 2008 Prentice-Hall, Inc.
Slide 3
Tomorrow’s Technology and You 8/e
Chapter 7
The Google Guys Search for Success
 Google is one of the most successful companies on WWW.
 Search for Web pages, facts, quotes, etc.
 200 million queries a day
 Tremendous database of material, but not organized
 Launched by a Sergey Brin and
Larry Page (Stanford Ph.D. students)
 New approach in search technology
 Marks a page’s relevance by the number of times other related
web pages link to it, not how often a word or phrase appeared
on a page
© 2008 Prentice-Hall, Inc.
Slide 4
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
What Good Is a Database?
 A database:
 A collection of information
 Database software:
 Application software
(like word processing and
spreadsheet software)
 e.g. Microsoft Access
 Designed to create, update, query databases of information
(collections of information)
© 2008 Prentice-Hall, Inc.
Slide 5
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 Advantages offered by computerized databases:
 Make it easier to store large quantities of information
 Make it easier to retrieve information quickly and flexibly
 Make it easy to organize and reorganize information
 Make it easy to print and distribute information in a variety of ways
© 2008 Prentice-Hall, Inc.
Slide 6
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
Database Anatomy
Database program: a software tool for organizing the
storage and retrieval of information
Database: a collection of information stored in an
organized form in a computer
Typically composed of one or more tables
A collection of related information
A collection of records
© 2008 Prentice-Hall, Inc.
Slide 7
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 A record is the information relating to one person, product, or
event.
 Each specific (individual) piece of information in a record is
called a field. (e.g. First name, last name, etc)
Field
Record
Table
© 2008 Prentice-Hall, Inc.
Slide 8
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 Database programs provide you with more than one way to
view data:
 Form views
Show one record at a time
 List views
Display several records in lists similar to the way a spreadsheet displays
data
© 2008 Prentice-Hall, Inc.
Slide 9
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
In any view, fields can be
rearranged without changing
the underlying data.
Form View
List View
© 2008 Prentice-Hall, Inc.
Slide 10
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
Database Operations
 Update: enter information into the database
 e.g. a new customer)
 Browse: navigate through information
 Query: find records that match specific criteria
 E.g. A pharmaceutical company marketing a new
menopausal drug might query their database to find all
female customers from the state of Illinois over 35 for a
targeted ad campaign
© 2008 Prentice-Hall, Inc.
Slide 11
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 Sort: rearrange records (alphabetically or numerically)
 Print reports, labels, and form letters: A report is an
ordered list of selected records and fields in an easy-to-read
format.
 Current database software has excellent report-generating
capabilities
© 2008 Prentice-Hall, Inc.
Slide 12
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 Asking questions of the database is called querying. Generating
a query is probably the most important and widely used feature
of the database.
 Find all users over 25 years old
 Find all products that have sold over 20,000 items
 Find all male users between 20 and 50 years old who live in
the state of Illinois whose license plate number begins with
‘TMX’
 Find all products that have sold less than 1000 items. 
Remove those items from the catalog.  Remove those
items from the ‘Orders’ table.
© 2008 Prentice-Hall, Inc.
Slide 13
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
 Because queries are so important, most modern database
management programs support a standard language for
programming complex queries called SQL (Structured Query
Language).


SQL is usable on the large majority of database management systems.
E.g. The following SQL query will query a table called ‘nobel’ to name
all the Nobel prize winners from the year 1950:
 SELECT winner_name FROM nobel WHERE year=1950
.
© 2008 Prentice-Hall, Inc.
Slide 14
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
The Web: the world’s largest
– but least organized –
database
© 2008 Prentice-Hall, Inc.
Slide 15
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
Screen Test: Querying a Web Search Database
To search for articles
online about a new method
for recycling laser printer
toner cartridges, you can
visit a search engine, such
as Google.
© 2008 Prentice-Hall, Inc.
Slide 16
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
When you hit the
“Search” button, the
search engine will return
a list of links, sorted by
relevancy.
© 2008 Prentice-Hall, Inc.
Slide 17
Tomorrow’s Technology and You 8/e
Chapter 7
The Web as database
 Because the data on the web is not stored in a relational database
or DBMS (i.e. no underlying structured organization such as
tables and forms), it cannot be queried in any structured way
such as by using SQL.
 Instead, web search engines search through all(!) of the pages on
the web and using various algorithms, attempt to somehow
organize the type of information stored on each page. It stores
this information in something called an index.
 When you type a query, the search engine, it searches its index to
see which web pages best match your search text
.
© 2008 Prentice-Hall, Inc.
Slide 18
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
Personal information manager (PIM): an
electronic organizer
Automates some or all of the following functions:
Address/phone book
Appointment calendar
To-do list
Miscellaneous notes
Handheld computers can share information with
applications such as iCalendar running on PCs and
Macintoshes.
© 2008 Prentice-Hall, Inc.
Slide 19
Tomorrow’s Technology and You 8/e
Chapter 7
The Electronic File Cabinet: Database Basics
© 2008 Prentice-Hall, Inc.
Slide 20
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
Database Management Systems
 Database management system (DBMS): manipulates data in a
large collection of files, cross-referencing between files as
needed
© 2008 Prentice-Hall, Inc.
Slide 21
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
 A DBMS can be used interactively, or can be controlled
directly by other programs.
© 2008 Prentice-Hall, Inc.
Slide 22
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
What Makes a Database Relational?
To most users, a relational database program is one
that allows tables to be related to each other.
 Changes in one table are reflected in other tables
automatically.
To computer scientists, the term relational database
has a technical definition related to:
 The underlying structure of the data
 The rules specifying how that data can be manipulated
© 2008 Prentice-Hall, Inc.
Slide 23
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
 The structure of a relational database is based on the relational
model―a mathematical model that combines data in tables.
A database is relational
when files are related
to each
other, such as this
Student ID field in the
Student file.
© 2008 Prentice-Hall, Inc.
Slide 24
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
The Many Faces of Databases
 Large databases can contain hundreds of interrelated tables.
 A database management system can shield users from the
complex inner workings of the system, providing them with only
the information and commands they need to get their jobs done.
© 2008 Prentice-Hall, Inc.
Slide 25
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
The Many Faces of Databases
© 2008 Prentice-Hall, Inc.
Slide 26
Beyond the Basics:
Database Management Systems
Database Trends
 Batch processing: users accumulate transactions and input
them into the computer in large batches
 E.g. At end of the day, enter all the new customer records into the
database
 Real-Time computing: allows instant access to information
 Interactive processing: has replaced batch processing for
most applications
 Users can now interact with data through terminals, viewing and
changing values online in real-time.
 Batch processing is still used for jobs in which it makes sense to do a lot
of transactions at once.
 E.g. At end of the week, query ‘Payroll’ table for current employees and print out
paychecks
© 2008 Prentice-Hall, Inc.
Slide 27
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
Client/server computing
involves two-way
communications between
applications running on the
“client” PC and the
“server” PC.
A travel agent might query an airline’s computer for schedule and fare information
© 2008 Prentice-Hall, Inc.
Slide 28
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
Downsizing and Decentralizing
 Using a client/server approach
 Today many businesses use a client/server approach, using database servers.
 Users can take advantage of the PC’s simple user interface and convenience,
while still having access to data stored on large server systems.
© 2008 Prentice-Hall, Inc.
Slide 29
Tomorrow’s Technology and You 8/e
Chapter 7
Using the web to query a database
 Every time you search Amazon or any other online store, a query is
being generated in a database maintained by that company.
 Hypothetical examples:
 E.g. Select * from ‘books’ where keywords include Harry Potter Chamber
 E.g. Select schedule, fare from flights where departure city = ORD and
arrival city = YUL and departure date = Febuary 27
© 2008 Prentice-Hall, Inc.
Slide 30
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
 Data Mining:
 The discovery and extraction of hidden predictive information from large
databases
 Uses statistical methods and artificial intelligence technology

Locates trends and patterns in data that would have been overlooked by
normal database queries
“The goal is
information
at your
fingertips.”
Bill Gates
© 2008 Prentice-Hall, Inc.
Slide 31
Tomorrow’s Technology and You 8/e
Chapter 7
Beyond the Basics:
Database Management Systems
Rules of Thumb: Dealing with Databases




Choose the right tool for the job.
Think about how you’ll get the information out before you put it in.
Start with a plan, and be prepared to change your plan.
Make your data consistent; inconsistencies can mess up sorting and
make searching difficult.
 Databases are only as good as their data.
 Query with care.
 If at first you don’t succeed, try another approach.
© 2008 Prentice-Hall, Inc.
Slide 32