Вы находитесь на странице: 1из 11

CENTRALIZED VS.

DISTRIBUTED DATABASE SYSTEM


Centralized Database System

the database used by the system are all located on a single computer,
such as a server or mainframe computer.
Users in remote locations access the data through the Wide Area
Network (WAN) using the application programs provided to access the
data.
e.g. Some major banks do all their processing on a mainframe,
in some cases in a different country. Clients may use several
branches, and online banking for transactions.
-Airline reservation systems need to be centralised to avoid
double bookings.

The centralized database (the mainframe or the server) should be able


to satisfy all the requests coming to the system, therefore could easily
become a bottleneck. But since all the data reside in a single place it
easier to maintain and back up data.

Distributed Database System

the data is stored in storage devices that are located in different


physical locations. They are not attached to a common CPU but the
database is controlled by a central DBMS.
e.g. for instance, there might be one database stored on a
server located at the company headquarters and additional
databases stored on computers located at each retail store.
Users access the data in a distributed database by accessing the WAN.
To keep a distributed database up to date, it uses the replication and
duplication processes.
Depending on the number of distributed databases, this process could
become very complex and time consuming.

DISK-BASED VS. IN-MEMORY DATABASE SYSTEMS


Disk- Based Database System

the data is stored primarily on disk, and usually the server copies only
small pieces of data at a time into memory.

So it will consume time and more RAM

An in-memory database system is a database management system that


stores data entirely in main memory. This contrasts to traditional (on-disk)
database systems, which are designed for data storage on persistent media.
Because working with data in memory is much faster than writing to and
reading from a file system, IMDSs can perform applications data
management functions an order of magnitude faster. Because their design is
typically simpler than that of on-disk databases, IMDSs can also impose
significantly lower memory and CPU requirements.

DATABASE MODELS

is a type of data model that determines the logical structure of a


database and fundamentally determines in which manner data can be
stored, organized, and manipulated.
A model is not just a way of structuring data: it also defines
a set of operations that can be performed on the data. The
most popular type of database model is Relational Model
that I will discuss later.

The Hierarchical and Network Database Model

organizes data in a tree structure. There is a hierarchy of parent and


child data segments.
This structure implies that a record can have repeating
information, generally in the child data segments. Data in a
series of records, which have a set of field values attached to it.

It collects all the instances of a specific record together as a record


type. Typically, a one-to-many relationship exists between data
entities, so all entries in the second row of the hierarchy are listed
under only one top-row entry.
To create links between these record types, the hierarchical
model uses Parent Child Relationships and it is done by using
tree structure. For example, an organization might store

information about an employee, such as name, employee


number, department, salary. The organization might also

store information about an employee's children, such as


name and date of birth. The employee and children data
forms a hierarchy, where the employee data represents the
parent segment and the children data represents the child
segment.

The Relational Database Model

is a collective set of multiple data sets organized by tables, records and


columns. RDBs establish a well-defined relationship between database
tables.
Tables communicate and share information, which
facilitates data searchability, organization and reporting.
the process of entering data into the database or otherwise using the
database (such as adding, modifying, or deleting records or retrieving
information from the database)called data manipulationcan be
carried out.
Before a relational database can be created, it should be
properly designed. So it should be a systematized process
that follows steps.

Designing a Relational Database

identify the purpose of the database and the activities that it will be
used for.
(such as to keep track of rental properties, student grades,
or customer orders)
Determine the tables and fields to include in the database.
To determine which fields go in which table, you should
group fields that logically belong togethereach group of
fields will fo2rm one table.
Assign the fields to the appropriate table and restructure as needed to
minimize redundancy (normalization).
To keep redundancy to a minimum, fields should be
included in only one table whenever possible; they should
not be placed in multiple tables unless they are needed to
relate one table to another.
Finalize the structure of each table, listing each fields name, type,
size, and so on and selecting a primary key (data definition).

Another consideration when designing and evaluating the


basic structure of each table is ensuring the fields are
constructed in a manner consistent with the type of
information that will need to be extracted from the
database. For example, if you want to be able to generate
a list of people by just their last name, two separate fields
(such as Last Name and First Name) should be used
instead of just a single field called Name.

Creating a Relational Database


To create a relational database, a new database file (that will contain all
tables and other objects included in the database) is first created and
named. Next, each table in the database is created, using the table structure
developed during the database design process. Once the table structure is
complete, data can be entered into the tables and the tables can be related
as needed.
Creating the Tables
To create a table in Design view, you enter each field name and specify
the data type and other properties as needed, and then save the table
using an appropriate table name. To create a table in Datasheet view,
you enter the first record of data into the table to initially create the
fields for that table, and then you can change the field names and
other properties as needed using the Datasheet tab on the Ribbon in
recent versions of Microsoft Access. You then need to save the table
using an appropriate table name. However, only very basic properties
(such as the field name, data type, and whether or not the field is
required) can be specified using Datasheet view, so Design view is
often still needed to finalize the table structure (such as to change the
primary key or add a validation rule or an input mask).
Entering and Editing Data
If a new database is to be used with existing data, the data needs to be
transferred from the old files to the new systema process called data

migration. If new data is to be used, it is entered into the appropriate


database table. Datasheet view can be used to enter data into a table
as previously described; however, a form (see Figure 14-15) can be
created for a table and used instead for easier data entry and a more
professional appearance. When a form is created, it automatically
includes all of the fields in the table with which the form is associated.
If a specific form layout or design is desired, Design view can be used
to edit the form, such as to change the form color or the font size used,
rearrange the placement of the fields on the form, add a company logo
or form heading, and so forth. Either Datasheet view or a form can be
used to input, view, and edit data for a table. In either case, records
can be added to the table (click the New (blank) record button at the
bottom of the table or form to display a new blank record), deleted
from the table (use the Home tab on the Ribbon in Microsoft Access to
delete the current record), or edited (display the appropriate record
and then click the field to be edited). Regardless of whether Datasheet
view or a form is used to edit the table data, it is the same data that is
being edited. So if a new record is added using a form, for example,
the new record will be visible when the table is viewed using Datasheet
view; and, if an address is edited in Datasheet view, the updated
address will be visible when the record is viewed using a form.

Relating Tables
After all the tables in a database application have been created and
their primary keys designated, the tables can be related to one another
via their primary keys so that a primary key for one table can be used
to extract data from other tables as needed. For instance, once a
Customer table (containing customer data) and an Order table
(containing order data) are related via the Customer tables Customer
Number primary key field, then that field can be used to extract
information from both of these tables, such as to generate an order
report or an invoice containing data from the Customer table and the
Order table. The process of relating tables in the Inventory database
discussed throughout this chapter is shown in Figure 14-16. This figure
also illustrates how, once the tables are related, the related data
located in other tables can be viewed from inside a single table.

Retrieving Information from a Relational Database


Database information retrieval can be performed by displaying a single
record to answer a specific question about that entity (such as looking up a
customers phone number or current balance by displaying the appropriate
record in the Customer table). However, more often information is retrieved
from a database using a query or a report.
Query

A query extracts specific information from a database by specifying


particular conditions (called criteria)
about the data you would like to retrieve, such as retrieving all names
of customers who live in Tennessee or all products whose inventory
level is below 100 units.
Every DBMS provides tools users can use to query the database for
information. One possibility is using a query language, such as
structured query language (SQL)the standard query language for
relational databases.
To create a query, users can either type a query using SQL or,
more commonly, use the query tools built into the DBMS (such as
a query design screen or query wizard) to create a query object.
In either case, the query can then be used to extract the data
from the table associated with the query that meets the query
conditions. An example of creating a query for the Product table
using the query design screen in Microsoft Access (along with the
SQL version of that query that can be viewed and edited if
desired by selecting the SQL View option from the View menu on
the Home tab) is shown in Figure 14-17. As shown in this figure,
the query is created, named, and saved as an object in the
database file. Each time this query is run (by opening the
appropriate query object), only the records in the Product table
meeting the criteria are displayed. In addition to retrieving
information from a single table, queries can retrieve information
from multiple tables, if the tables are related.

Queries need to be designed to extract the requested information as


efficiently as possible. Poorly written queries can impact the overall
performance of the system, especially if they are executed frequentlyin
some systems, queries may be enacted several times per second. Even a
marginal improvement in performance of frequently used queries can
significantly improve the overall performance of the system. Consequently, it

is the job of the database administrator to identify regularly used queries


that need improvement and to suggest ways in which to make them perform
better. Common techniques include alterations to the query itself to improve
its performance, adding hints to the query to tell the database which tables
should be accessed first to speed up performance, and adding additional
indexes to heavily used tables.
Report

When more formal or attractive output is needed, a report can be used.


In essence, a report is a formatted way of looking at some or all of the
data contained in a database.
The fields to be included in a report are specified when the report
is created. A report can be designed to include all the records
located in its associated table, or it can be designed to include
just the results of a query.
Like queries, reports in Microsoft Access are saved as objects in the
database file, they can pull information from more than one table at a
time if the tables are related, and they display the data located in the
appropriate tables at the time the report is run.
Reports are often created initially using a report wizard (such as
the Microsoft Access Report Wizard shown in Figure 14-18) and
then their appearance can be modified using Design view, similar
to the way a form can be modified.

Maintaining a Relational Database


Although small, personal databases may need little or no maintenance, large
enterprise databases frequently require regular maintenance. Maintenance
activities are usually performed by the database administrator and include
the following tasks:

Modifying the table structure to add new fields or to accommodate


values that turned out to be different from those anticipated when the
database was designed, such as a customer last name that is longer
than the field size specified for the Last Name field.
Adding new indexes, which can be used to speed up queries.
Deleting obsolete data, such as for customers who no longer exist or
who have not placed orders for a specified period of time.
Upgrading the database software as needed and installing security
patches as they become available.

Repairing or restoring data that has become corrupt, such as the result
of a storage media error or a computer virus.
Continually evaluating and improving the security measures used with
the database.

The Object-Oriented Database Model (OODBMS)

stores data in objects. An object contains data along with the methods
(actions) that can be taken with that data.
Attributes are data which defines the characteristics of an
object. This data may be simple such as integers, strings,
and real numbers or it may be a reference to a complex
object. Objects in an OODBMS can contain virtually any
type of dataa video clip, a photograph with a narrative,
text with music, and so onalong with the methods to be
used with that data.
Object databases should be used when there is complex data and/or
complex data relationships. This includes a many to many object
relationship.
Object databases should not be used when there would be
few join tables and there are large volumes of simple
transactional data. Object database work well with
Multimedia Applications because of complex datas.

Hybrid Database Models

a combination of two or more database types or models


For instance, a database that combines object and
relational database technology can be referred to as an
object-relational database management system (ORDBMS)

Multidimensional Databases

It is designed to store a collection of summarized data for quick and


easy data analysis.
Whereas relational databases are appropriate for
transactional applications in which data is retrieved or
updated typically by rows and object-oriented databases

are appropriate when a variety of types of objects need to


be stored and retrieved
The data is typically collected from a variety of enterprise-wide
activities and is then summarized and restructured to enable it to be
viewed from multiple perspectives called dimensions.
For example, sales for a company could be viewed in the
dimensions of product model, geography, time, or
salesperson, or viewed as a combination of dimensions,
such as sales by a particular product model in the
southwest United States for Quarter 2 in 2013. The
dimensions are predefined, based on what are viewed to
be meaningful for that particular database, and the
summarized data values are automatically calculated.

DATABASES AND THE WEB


Databases are extremely common on the Web. Virtually all
companies that offer product information, online ordering,
research resources, or similar activities via a Web site use a
database. For instance, one of the largest databases on the Web
belongs to Amazon, which stores data about its customers and
their orders, products for sale, and customer reviews of products.
Examples of Web Database in Use

Information retrieval
the Web is, in essence, a huge storehouse of data waiting
to be retrieved. Data to be accessed and displayed via a
Web page is often stored in a database, and Web site
visitors can request and view information upon demand.
Store user-generated content
such as content uploaded to Flickr, YouTube, Facebook, and
other social networking sites.
Support and facilitate e-commerce
such as to display product information, pricing, customer
information, shopping cart content, order information, and
more upon demand. Other information commonly retrieved
and displayed from Web databases include product
information, press releases, and other documents retrieved
from company Web sites; ZIP codes, driving directions,
maps, and more retrieved from reference sites (see Figure

14-21); and photos and videos retrieved from photo and


video sharing sites.
Web databases allow Web pages to be dynamic Web pages.
Web pages in which the appearance or content of the
pages changes based on the users input or stated
preferences instead of just displaying static information via
the Web pages included on the site. In addition to being
used to supply data on demand (such as via a Web site
search), Web databases also allow Web sites to display
personalized content for each visitor, such as to create a
personalized portal page or to display information based on
a users past activities, as is the case with the Amazon.com
Web page

How Web Databases Work


The request to retrieve information from or store data in a Web
database is typically initiated by the Web site visitor. Filling out a
Web page form and selecting an option from a menu displayed
on a Web page are common ways Web-based database requests
are made. The request is received by the Web server, which then
converts the request into a database query and passes it on to
the database server with the help of middleware.
Middleware

Software that connects two otherwise separate applications


software that acts as a bridge between an operating
system or database and applications, especially on a
network. Middleware is a general term for software that
serves to "glue together" separate, often complex and
already existing, programs. Some software components
that are frequently connected with middleware include
enterprise applications and Web services.

CGI Scripts
A CGI (common gateway interface) script is a set of instructions written in a
programming language (such as C, Perl, Java, or Visual Basic) and designed
to accept data from and return data to a Web page visitor. CGI scripts usually
reside on the Web server and handle tasks, such as processing input forms

and information requests. On very busy sites, CGI can slow down server
response time significantly because it processes each request individually.
Active Server Pages (ASPs)
Active Server Pages (ASPs) are dynamic Web pages that have the
extension .asp. ASPs work similarly to dynamic Web pages utilizing CGI
scripts but the code to tie the database to the Web site is typically written in
JavaScript or VBScript.
PHP Scripts
PHP (PHP Hypertext Preprocessor) is a scripting language that is increasingly
being used to create dynamic Web pages. It uses code similar to Perl or C++
that is inserted into the HTML code of a Web page using special PHP tags.
PHP scripts usually reside on the server and are typically used to perform
tasks similar to CGI and ASPs but they have the advantage of high
compatibility with many types of databases.s

Вам также может понравиться