Download Database

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

Commitment ordering wikipedia , lookup

Global serializability wikipedia , lookup

Serializability wikipedia , lookup

Microsoft Access wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Oracle Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

IMDb wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
Databases and Database Users
Outline: Introduction
(Chapter 1 – 3rd , 4th , 5th, 6th ed.)
• What is a database?
• The main characters of a database system
• The basic database design method
• The entity-relationship data model for application
modeling
Sept. 2012
Yangjun Chen
ACS-3902
1
Databases and Database Users
Types of databases
• traditional
• multimedia - pictures, video, sound
• Scientific database
- GIS: maps, weather, satellite images
- biological database: DNA sequence analysis
• warehouse, OLAP - analysis, decision making
• real-time, active databases - industrial processes
• deductive databases - combination of inference and
databases
• web databases
Sept. 2012
Yangjun Chen
ACS-3902
2
Databases and Database Users
Types of databases
• traditional
• multimedia - pictures, video, sound
• GIS - maps, weather, satellite images
• data warehouse, OLAP - analysis, decision making
• real-time, active databases - industrial processes
• deductive databases - combination of inference and
databases
Read Chapter 1
• web databases
For next day, read Chapters 2 and 3
Sept. 2012
Yangjun Chen
ACS-3902
3
Databases and Database Users
Database
• collection of related data
• represents some aspect of the real world
• logically coherent collection
• built with a specific purpose in mind
• could be anywhere - notebook, spreadsheet, Access,
Oracle, … could be manual / could be computerized
Data
• known and recordable facts
• name, phone number, address, grade, ...
Sept. 2012
Yangjun Chen
ACS-3902
4
Databases and Database Users
Database Management System (DBMS)
• collection of software facilitating the definition,
construction and manipulation of databases
Definition
•record structure
•data elements
•names
•data types
•constraints
etc
Sept. 2012
Construction
•create database
files
•populate the
database with
records
Yangjun Chen
ACS-3902
Manipulation
•querying
•updating
5
Databases and Database Users
Database Management System (DBMS)
• collection of software facilitating the definition,
construction and manipulation of databases
DBMS
Meta data
Request
manager
Storage
manager
Stored
database
Users/
actors
Sept. 2012
Yangjun Chen
ACS-3902
6
Databases and Database Users
Sample database
file2
file1
Course CName CNo CrHrs Dept
Database 8803 3
CS
C
2606 3
CS
Student Name StNo Class Major
Smith 17
1
CS
Brown
8
2
CS
Grades StNo Sid Grade
17
25 A
17
43 B
Section SId CNo Semester Yr
Instructor
32 8803 Spring 2000 Smith
25 8803 Winter 2000 Smith
43
Sept. 2012
2606
Spring 2000 Jones
Yangjun Chen
ACS-3902
file3
file4
7
Databases and Database Users
Meta data for table structures
REL_NAME ATTR_NAME ATTR_TYPE MEMBER_OF_PK MEMBER_OF_FK FK_RELATION
Cname
VSTR15
no
no
Course
Dept
STR9
no
no
Student
Name
STR20
no
no
Student
StNo
INTEGER
yes
no
StNo
INTEGER
no
yes
Course
... ...
... ...
Grade
Sept. 2012
Yangjun Chen
ACS-3902
Student
8
Databases and Database Users
Characteristics of the Database approach
• single repository of data
• sharable by multiple users
•concurrency control
•transaction control
• self-describing - system catalogue contains meta data
• program-data independence
• some changes to the database are transparent to
programs/users
• multiple views of data - to support individual needs of
programs/users
Sept. 2012
Yangjun Chen
ACS-3902
9
Databases and Database Users
Database Actors
• Database Administrator (DBA)
-
authorizing access to the database
coordinating and monitoring its use
aquiring software and hardware as needed
solving problems such as breach of security or poor system
performance
• Database Designers/Modelers
-
identifying the data to be stored
choosing appropriate data structure
• End-users
-
access to the database: querying, updating, generating reports
• Software Engineers
Sept. 2012
developing application programs
Yangjun Chen
ACS-3902
10
Databases and Database Users
Advantages of the Database approach
(capabilities we would look for in a DBMS)
• controlled redundancy
• database design integrates different user data needs
• performance tuning may lead to replicated data
• controlled/authorized access to data
• SQL Grant and Revoke commands
• enforcing integrity constraints
• intra-record constraints: e.g. data type, net<gross
• inter-record constraints: StNo in “Grades” exists as a
StNo in “Student”
• backup and recovery
Sept. 2012
Yangjun Chen
ACS-3902
11
Databases and Database Users
Implications of the Database approach
• standards enforcement
• DBA can enforce standard naming conventions, etc
• reduced application development time
• adding new functionality to an existing database is
“easy”
• flexibility
• adding new data and making some types of changes is
“easy”
• up-to-date information - due to sharable characteristic
• economies of scale - due to sharable resources the whole
organization can make one investment
Sept. 2012
Yangjun Chen
ACS-3902
12
Databases and Database Users
When not to use a DBMS
• overhead costs are too great
• high initial investment
• generality
• overhead of security, concurrency control, recovery,
integrity
• data and applications are simple, well-defined, not expected to
change
• stringent real-time constraints
• multi-user environment not needed
Sept. 2012
Yangjun Chen
ACS-3902
13
Databases and Database Users
Database design
• let’s jump ahead to see this
• ERDs are covered in Chapter 3
Course
1
Student
Delivery
M
N
Grades
Section
N
Sept. 2012
Yangjun Chen
ACS-3902
14
Databases and Database Users
Database design
• let’s jump ahead to see this
• ERDs are covered in Chapter 3
Course
StNo
Class
1
Student
Major
Delivery
Name
M
N
Grades
Section
N
Sept. 2012
Yangjun Chen
ACS-3902
15
Databases and Database Users
Database design
• let’s jump ahead to see this
• ERDs are covered in Chapter 3
CNo
CrHrs
Dept
Course
StNo
Class
CName
1
Student
Major
Delivery
Name
M
N
Grades
Section
N
Sept. 2012
Yangjun Chen
ACS-3902
16
Databases and Database Users
Database design
• let’s jump ahead to see this
CNo
CrHrs
• ERDs are covered in Chapter 3
Dept
Course
StNo
Class
CName
1
Student
Major
Delivery
Name
M
N
Grades
Semester
Section
N
Year
SId
Sept. 2012
Yangjun Chen
ACS-3902
Instructor
17
Databases and Database Users
Database design
• let’s jump ahead to see this
CNo
CrHrs
• ERDs are covered in Chapter 3
Dept
Course
StNo
Class
CName
1
Student
Major
Delivery
Name
M
N
Grades
Semester
Section
N
Year
grade
Sept. 2012
SId
Yangjun Chen
ACS-3902
Instructor
18
Databases and Database Users
name number
With attributes, etc:
fname
name
ssn
bdate
degree
1
lname
minit
sex
address
employee
supervisor
department
works for
N
salary
1
startdate
1
location
1
controls
manages
1
N hours
N
supervisee
number of
employees
N
M
1
works on
supervision
dependents of
project
name number
location
N
dependent
name
Sept. 2012
sex
birthdate relationship
Yangjun Chen
ACS-3902
19
Databases and Database Users
ER-to-Relational mapping
1. Create a relation for each strong entity type
2. Create a relation for each weak entity type
• include primary key of owner (an FK - foreign key)
• owner’s PK + partial key becomes PK
3. For each binary 1:1 relationship choose an entity and
include the other’s PK in it as an FK. Include any
attributes of the relationship
4. For each binary 1:n relationship, choose the n-side entity
and include an FK w.r.t the other entity. Include any
attributes of the relationship
Sept. 2012
Yangjun Chen
ACS-3902
20
Databases and Database Users
5. For each binary M:N relationship, create a relation for the
relationship
• include PKs of both participating entities and any
attributes of the relationship
• PK is the concatenation of the participating entity PKs
6. For each multivalued attribute create a new relation
• include the PK attributes of the entity type
• PK is the PK of the entity type and the multivalued
attribute
7. For each n-ary relationship, create a relation for the
relationship
• include PKs of all participating entities and any attributes
of the relationship
• PK may be the concatenation of the participating entity
PKs
Sept. 2012
Yangjun Chen
ACS-3902
21