Beruflich Dokumente
Kultur Dokumente
Develop reports;
Perform research
4 Types of Databases
Non-relational databases
Non-relational databases place information in field
categories that we create so that information is available
for sorting and disseminating the way we need it.
The data in a non-relational database, however, is limited
to that program and cannot be extracted and applied
to a number of other software programs, or other
database files.
Example: a spread sheet
Relational databases
In relational databases, fields can be used in a number of
ways (and can be of variable length), provided that they
are linked in tables.
It is developed based on a database model that
provides for logical connections among files (known as
tables) by including identifying data from one table in
another table
5 A Simple Relational Database Example
6
DataBase Management System
(DBMS)
Distributed Database
A single logical database that is
spread physically across
computers in multiple locations
that are connected by a data
communications link
Web Database
Data is accessible through Internet
Have different underlying
database models
Databases and the Web
10
11 Database Terminology
Logical data view –
How humans see things
18
19 Data entry considerations
Define “must” enter fields – no record is
complete unless: such and such is
entered;
Make data entry fool proof. Example:
Grade level can be entered as a
number (8 or 8th or eight). By using a
pull-down menu with the correct data
format these mistakes can be avoided.
Data Entry – additional considerations
Barcode scanners
USB or
Wireless attached to a
Palm or Pocket PC
Pocket PC
WiFi 802.11g, Bluetooth
Wireless networks (real-
time on demand
systems)
20
21 Input Data with Forms
A friendlier view of the database
Used for data input, menus, display and printing
Can perform Calculations and Combine fields
Present one record to the user
Often used to change or view data
22 Reports
Output of information in a printed report
Reports can be tailored to the needs of the data-
user, making the information they extract much
more useful
Allows you to group and summarize data
Can perform Calculations and Combine fields
Cannot Edit Data
Can Make Labels
23 Database Models
Flat files ’60
Two dimensional
Hierarchical ‘60
Set up in a tree structure
Network ‘70
Records are stored with links to other records
Relational ‘80
Most popular and a very powerful tool
Not just for storing data but also for accessing it.
Object oriented ‘90
Web enabled ‘90
24
25 Flat File Databases
Flat-file DBs are like the DBs you can construct in a
single spreadsheet page
All the information in the DB is in one file consisting of
one array of rows and columns.
Useful for simple data storage needs
Hard to manage large data needs
Can waste disk space
For example:
Department Students
DeptNum Name IDNum Name Course
Courses Professors
CourseNum Name Section IDNum Name
Department Professors
DeptNum Name IDNum Name DeptNum Course
… … … … … …
… … … … … …
… … … … … …
Courses
Students
Num ProfID Section IDNum Name Course
… … … … … …
… … … … … …
… … … … … …
Conceptual Level
Conceptual
Level
Physical
Level
39 Three Level Architecture of DBMS
continue…
Sales Officer Inventory Controller
View 1 View 2
External Item_Name Item_Name
Level Price Stock
Conceptual
Item_Number Character (6)
Conceptual
Item_Name Character(30)
Level Price Numeric(5,2)
Stock Numeric(4)
Physical
Stored_Item Length=50
Physical Item # Type = Byte(6), offset = 0, Index = Ix
Name Type = Byte(30), offset = 6
Level Price Type = Byte(8), offset = 36
Stock Type = Byte(4), offset = 44
40 External or View Level
The users of this level are not concerned with how these
logical data structures will be implemented at the physical
level, rather they just are concerned about what information
is to be kept in the database.
42 Conceptual Level
continue…
= is equal to
> is greater than
< is less than
>= is greater than or equal to
<= is less than or equal to
not is not equal to
54
55 Simple SQL Query
Textbooks
Title Price Category Publisher
Java Intro 109.99 Computers Prentice Hall
Calculus 129.99 Math Kaufman
Advanced C 115.99 Computers Tech Inc
Philosophy 83.99 Lib Arts Prentice Hall
SELECT *
FROM Textbooks
WHERE category=‘Computers’
Title Price Category Publisher
Java Intro 109.99 Computers Prentice Hall
“selection”
Advanced C 115.99 Computers Tech Inc
56 Simple SQL Query
Textbooks
Title Price Category Publisher
Java Intro 109.99 Computers Prentice Hall
Calculus 129.99 Math Kaufman
Advanced C 115.99 Computers Tech Inc
Philosophy 83.99 Lib Arts Prentice Hall
SELECT *
FROM Student
WHERE
Student.GPA > 3.0 AND
Student.Address = “Hostel”
59 Data Definition Language
Syntax for creating ,editing, deleting:
Databases
Tables
Indexes
Constraints
Users
Privileges
60 DDL Examples
CREATE DATABASE Inventory;
Creating tables
List the necessary fields
Steps to define a field
Descriptively name the field
Specify the field type
Determine the field size
62 Working with a Database
Field types
Describes the type of data stored
Most DBMS use the same types
Text fields store letters and numbers
Numeric field store numbers
Date and time field
Logical field stores yes or no
Binary field stores images or sounds
Counter field generates sequential
numbers
Memo fields store large amounts of data
63 Working with a Database
Viewing records
Datasheet view shows all records
Filters can limit the records shown
Display only records matching a criteria
Forms allow viewing one record
65 Working with a Database
Sorting records
Order records based on a field
Multiple sub sorts resolve ‘ties’
Several types of sorts
Alphabetic
Numeric
Chronological
Ascending
Descending
66 Working with a Database
Querying a database
Statement that describes desired
data
List of fields can be modified
Uses of querying
Find data
Calculate values per record
Delete records
Most important DBMS skill
67 Working with a Database
Query languages
All DBMS use a query language
Structured Query Language
(SQL)
Most common query language
Select FirstName, LastName, Phone
From tblPhoneNumbers
Where LastName=“Norton”;
68 Working with a Database
Generating reports
Printed information extracted from
a database
Can calculate data
Calculate data per row
Calculate for entire table
Pictures and formatting can be included