Database System

advertisement
Prof. Cantonjos
Components of Database System
 DATA
 HARDWARE
 SOFTWARE
 USER
Advantages
 ECONOMY OF SCALE - The concentration of
applications in one location allows for the possibility
of smaller numbers of larger and more powerful
computers, which usually results in an economy of
scale. The same economy of scale may be realized by
the concentration of technical expertise. In general,
economy of scale refers to the fact that the collective
cost of several combined operations may be less than
the sum of the cost of the individual operations.
 GETTING MORE INFORMATION FROM SAME
AMOUNT OF DATA – The primary goal of a computer
system is to form data (recorded facts) into
information gain by processing these facts.
 SHARING OF DATA – The data can be stored among
authorized users, allowing users access to more of the
data.
 BALANCING CONFLICTING REQUIREMENT – For
the database approach to function adequately, there
must be a person or a group within the organization in
charge of the database itself. This group is often
Database Administration (DBA).
 ENFORCEMENT OF STANDARDS – With the central
control mentioned in the previous paragraph, DBA
can ensure that standards for such things as data
names, usages & formals are followed uniformly
throughout the organization.
 CONTROLLED REDUNDANCY – In the database
approach since there is only one occurrence of each
faculty member, this redundancy is eliminated.
 INTEGRITY – An integrity constraints in a rule that
data in the databases must follow. A database satisfies
all integrity constraints that have been established.
Note:
Integrity – accuracy of encode
 SECURITY – Security is the prevention of access to the
database by unauthorized users.
 Incription – transformation of program into different
meaning
 FLEXIBILITY AND RESPONSIVENESS – The
flexibility furnished by the DBMS to locate and access
data in a number of different ways aids programmers
in developing new programs to satisfy user requests.
 INCREASED PROGRAMMER PRODUCTIVITY –
studies have shown that on the coverage they will be
two to four times more productive (i.e. a new
application can be developed in one quarter to one
half of the time it would take if it were straight file
oriented approach. )
 IMPROVED PROGRAM MAINTENANCE – Many
changes to the structure of the data itself may not
require maintenance to existing application programs.
 DATA INDEPENDENCE – Without such
independence, changes to the database structure to
improve performance are to meet changing corporate
requirements become very complex. Data
independence occurs when the structure of the
database can change without requiring the programs
that access the database to change.
Disadvantages of Database
 Size
 Complexity
 Cost
 Additional hardware requirements
 Higher impact of a failure
 Recovery more difficult
USERS
 Users of the database
 A. ACTORS ON THE SCENE – People whose jobs
involves the day to day use of large databases
 1. DATABASE ADMINISTRATORS - The chief
administrators to oversee and manage the resources
 DATABASE Designers – responsible for identifying
data to be stored in the database and for choosing
appropriate structures to represent and store this data.
 END USERS – Persons whose jobs require access to the
database for querying, updating and generating
reports
 CASUAL END USERS
 NAÏVE END USERS
 SOPHISTICATED END USERS
 SYSTEM ANALYST AND APPLICATION
PROGRAMMERS – Determine the requirements of
end users, especially naïve and parametric end-users
and develop specifications for canned transactions
that meet this requirements.
Workers behind the scene
 DBMS DESIGNERS AND IMPLEMENTORS
 TOOL DEVELOPERS
 OPERATORS AND MAINTENANCE PERSONNEL
nd
2
Lecture
 RELATIONAL DATABASE MANAGEMENT SYSTEMS
 Designed to create, maintain, manipulate, modify and
delete information in a relational database.
Structured Database Model
Hierarchical Model -
Publisher
Authors
Manuscript
Bookstore
Deliveries
Payment
Things you can do with RDBMS
 CREATE A DATABASE – Personal and business
database need to be created and RDBMS programs will
help facilitate this process. Database creation is made
easier and faster because of these programs.
 INFORMATION STORAGE – Once your database is
created, it is now easy to add information into your
database. For example, if you have a list of mp3 music
in your computer, as new music becomes available you
simply add this data into your database and categorize
it to the attributes you have created, whether it is a jazz
or rock, classical or modern, you can also rate it as one
of the favorites. A database program allows you to add,
organize, modify, edit and delete your information as
you deemed fit.
 INFORMATION RETRIEVAL – Since your database is
created in a structured fashion, it is easy to retrieve
data. In databases, the means to retrieve data is by
query. Query is a request for specific information from
the created database. For example, when you were
young your parents used to play music from the
“Eagles” band entitled “Hotel California”. If they want
to play that song, they can retrieve it from the database
and play the music.
 INFORMATION MANAGEMENT – RDBMS programs
allow you to utilize and modify the information in a
database according to your needs. You may add
attributes for example to your music database so that
you would be able to sort and arrange it according to
artist, date the music was released and so on.
 INFORMATION ANALYSIS – The most important
function of a database is using it. Data accumulated
and gathered is an asset in this Information Age. For
example in business, you would be able to track the
interest of a certain generation of people in their
interest of clothing, music, shoes and eating habits.
 PRINT AND SHARE INFORMATION – For purposes
of a “hard copy” information may be printed and
stored as back up copy in case the digital copy of the
database gets corrupted or damaged. Printed
information is also necessary for people who are not
used to viewing data in the computer monitor and
prefers them on paper. The internet revolution has also
made it possible to place your data on a website, send
via email and shared to others over a network.
Qualities of Good Database
Information
 ACCURATE INFORMATION
 ORGANIZED
 TIMELY INFORMATION
 VERIFIABLE INFORMATION
 ACCESSIBLE INFORMATION
 ECONOMICAL INFORMATION (Cost Effective)
 USEFUL INFORMATION
ASSIGNMENT #2
 MODELS OF DBMS with graphical illustration
 Submit it in a sliding folder
rd
3
Lecture
STRUCTURED DATABASE MODELS
- HIERARCHICAL MODEL
- NETWORK MODEL
- RELATIONAL MODEL
- ENTITY-RELATIONSHIP MODEL
- DIMENSIONAL MODEL
- OBJECT – RELATIONAL MODEL
DATABASE TERMINOLOGIES
 DATA – IT IS A NUMBER OR VALUE FOUND AND
STORED IN THE DATABASE. DATA IS STATIC
BECAUSE IT REMAINS THE SAME UNTIL IT IS
MODIFIED BY A PROCESS
 INFORMATION –
IT IS A DATA THAT HAS BEEN PROCESSED
THEREBY MAKING IT RELEVANT AND
MEANINGFUL TO THE PERSON VIEWING IT.
 NULL –
IT IS USED TO REPRESENT A VALUE THAT IS
UNKNOWN OR MISSING. A NULL VALUE IS
NEITHER A ZERO NOR BLANK.
 TABLE
- IT IS THE MAIN STRUCTURE IN THE RELATIONAL
DATABASE. IT IS COMPOSED OF ATTRIBUTES
(FIELDS) AND DOMAIN (RECORDS)
 FILE
 ORGANIZED COLLECTION OF DATA ABOUT AN
ENTITY.

EXAMPLE: FOR A BOOKSTORE, A FILE CALLED “
BRANCH” CAN CONTAIN ALL THE DATA ABOUT A
PARTICULAR BOOKSTORE BRANCH.”
 RECORD
 IT REFERS TO A SPECIFIC PERSON, PLACE, THING
OR EVENT. RECORD IS ALSO KNOWN AS THE
“TUPLE” IN THE RELATIONAL DATABASE
TERMINOLOGY. IT PERTAINS TO STRUCTURE IN
THE DATABASE TABLE REPRESENTING A UNIQUE
INSTANCE OF A SUBJECT.
 FIELD
 IT IS THE SMALLEST STRUCTURE OF A DATA FROM
A LARGER DATABASE STRUCTURE IN A
RELATIONAL DATABASE. A FIELD CAN STORE DATA
IN A DATABASE AND REPRESENT A CHARACTER OF
THE SUBJECT TO WHICH DATABASE TABLE IT
RESIDES.
 VIEW
 IT IS ALSO KNOWN AS A VIRTUAL TABLE. IT IS
CALLED A VIRTUAL TABLE SINCE IT DOES NOT
HOLD DATA ON ITS OWN; RATHER IT GETS DATA
FROM THE TABLE TO WHICH IT IS BASED. AND
SINCE IT COMES FROM OTHER TABLES IT IS
COMPOSED OF SEVERAL FIELDS COMING FROM
ONE OR MORE DATA.
 KEYS
 THESE ARE FIELDS THAT SERVE SPECIFIC
PURPOSES WITHIN A TABLE. THERE ARE 2 TYPES
OF KEYS, THE PRIMARY KEY AND THE FOREIGN
KEY. THE PRIMARY KEY IS A FIELD THAT UNIQUELY
IDENTIFIES A RECORD IN THE TABLE. THE FOREIGN
KEY IS A SPECIAL FIELD THAT ESTABLISHES A
RELATIONSHIP BETWEEN 2 TABLES.
 RELATIONSHIPS
 THEY EXIST WHEN 2 OR MORE TABLES HAVE
CONNECTION OR ASSOCIATION.
RELATIONSHIPS
 RELATIONSHIPS IN RELATIONAL DATABASE EXIST
WHEN 2 OR MORE TABLES ARE CONNECTED BY
THE FOLLOWING CONDITIONS:
 1. PRIMARY KEY
 2. FOREIGN KEY
 LINKING TABLE IS A TABLE THAT ESTABLISHES A
CONNECTION BETWEEN 2 OR MORE TABLES.
TYPES OF RELATIONSHIPS
 ONE-TO-ONE RELATIONSHIPS
 THIS RELATIONSHIP EXISTS BETWEEN TABLES
WHEN ONLY ONE RECORD OF THE FIRST TABLE IS
RELATED TO ONLY ONE RECORD OF THE SECOND
TABLE.
EXAMPLE:
 EMPLOYEES TABLE
EMPLOYEE ID
FIRST NAME
LAST NAME
001
MICHAEL
CRUZ
002
MATTHEW
FRANCISCO
EMPLOYEE ID
DAILY RATE
INCENTIVE
PERCENTAGE
001
350.00
5%
002
250.00
10%
 SALARY TABLE
ONE TO MANY RELATIONSHIPS
 THIS RELATIONSHIP EXISTS BETWEEN TABLES
WHEN ONE RECORD OF THE FIRST TABLE CAN BE
RELATED TO ONE OR MORE RECORDS TO A
SECOND TABLE, BUT ONLY ONE RECORD FROM
THE SECOND TABLE CAN BE RELATED TO A
SINGLE RECORD IN THE FIRST TABLE. THIS
RELATIONSHIP IS THE MOST COMMON
RELATIONSHIP THAT EXISTS BETWEEN TABLES
AND HELPS TO REDUCE OR ELIMINATE
DUPLICATE DATA.
EXAMPLE:
 A Publisher is associated with all the books that it
publishes while a book is associated with a publisher.
PUBLISHER
CODE
NAME
COUNTRY
198801
JEMMA INC.
PHILS.
ISBN
PUBLISHER
CODE
BOOK TITLE
9781235
198801
CREATIVE
DESIGN
9781236
198801
SPREADSHEETS
9781237
198801
OFFICE PROD.
MANY-TO-MANY RELATIONSHIPS
 THIS RELATIONSHIP EXISTS BETWEEN TABLES
WHEN ONE RECORD OF THE FIRST TABLE CAN BE
RELATED TO ONE OR MORE RECORDS TO A
SECOND TABLE AND ONE RECORD FROM THE
SECOND TABLE CAN BE RELATED TO ONE OR
MORE RECORDS TO THE FIRST TABLE. THE
CONNECTION BETWEEN THE TWO TABLES WILL
BE DIFFICULT TO ESTABLISH AND WILLRESULT
TO REDUNDANT DATA IN ONE OF THE TABLES.
STUDENTS TABLE
STUDENT NUMBER
FIRST NAME
LAST NAME
20091
AGNES
ONG
20043
RICHARD
TAN
SUBJECTS TABLE
CODE
NAME
FACULTY ID
MATH01
MATH
8852
SCIENCE 01
SCIENCE
8821
DESIGNING A DATABASE
 DEFINE THE PURPOSE OF YOUR DATABASE
 DETERMINE THE TABLES THAT YOU NEED IN THE
DATABASE
 DETERMINE THE FIELDS THAT YOU NEED IN THE
DATABASE
 IDENTIFY UNIQUE FIELD VALUES THAT WILL
ALLOW ACCESS TO CONNECT INFORMATION
STORED IN A SEPARATE TABLE
 DETERMINE THE RELATIONSHIPS BETWEEN
TABLES
 TEST THE DESIGN BY ENTERING THE SAMPLE
DATA
CHARACTERISTICS OF A WELL
DESIGNED DATABASE
 MODIFYING DATA IS EASY. CHANGES TO THE
VALUE OF ONE FIELD WITHIN THE TABLE
SHOULD NOT AFFECT THE VALUES OF THE
FIELDS IN THE TABLE.
 RETRIEVING INFORMATION IS EASY. EXTRACTING
DESIRED INFORMATION FROM TABLES WITH
WELL DEFINED RELATIONSHIPS SHOULD MAKE
ACCESSING AND RETRIEVING DATA A LOT
FASTER.
 DEVELOPING AND BUILDING USER APPLICATION
IS EASY. DATA MANIPULATION WOULD BE THE
MAIN FOCUS OF PROGRAMMING AND NOT
SOLVING THE PROBLEMS ASSOCIATED WITH A
POORLY DESIGNED DATABASE
 MAINTAINING THE STRUCTURE IS EASY.
CHANGES MADE TO ANY TABLE OR COLUMNS
SHOULD NOT AFFECT OTHER TABLES OR
COLUMNS.
 ADDING AND DELETING DATA IS EASY.
Download