Sunteți pe pagina 1din 7

CHAPTER I Introduction to Database

Management
Premiere Products- is a distributor of
appliances, housewares, and sporting
goods.
Redundancy- is the duplication of data or
the storing of the same data in more than
one place.
The
sample
order
has
three
components:
The heading (top) of the order
The body of the order contains one or
more order lines, sometimes called line
items. Each order line also contains a
total, usually called an extension,
The footing (bottom) of the order
contains the order total.
Database is a structure that contains
information
about
many
different
categories of information and about the
relationships between those categories.
Entity is a person, place, object, event, or
idea for which you want to store and
process data/ table names.
Attribute is a characteristic or property of
an entity/ also called a field or column.
Relationship is an association between
entities.
One-to-many relationship- example a
rep is associated with all of his or her
customers, and a customer is associated
with its rep.
Entity-relationship (E-R) diagram- rectangles represent entities, and lines
represent relationships between connected
entities.One- no arrow head/ absence of
dot and many- is indicated by a single

headed arrow/ dot.


Data file- a file that is used to store data,
it is a computer counterpart to an ordinary
paper file you might keep in a file cabinet.
Database management system (DBMS)
is a program, or a collection of programs,
through which users interact with a
database.
USER--> DBMS--> Database
Popular DBMSs include Access, Oracle,
DB2, MySQL, and SQL Server.
DBMS using another program:
*Visual Basic, Java, Perl, PHP, or C++.
USER-->
Program-->
DBMS-->
Database.
Database Design- is the process that
determines the structure of the required
database.
Forms- which are screen objects used to
maintain, view, and print data from a
database.
Advantages of Database Processing
-Getting more information from the same
amount of data
-Sharing data
-Balancing conflicting requirements
-Controlling redundancy
-Facilitating consistency
-Improving Integrity
-Expanding Security
-Increasing Productivity
-Providing Data Independence
Database administrator or database
administration (DBA)-a person or group
should be in charge of the database,
especially if the data- base will serve
many users.

Integrity constraint is a rule that data


must follow in the database.
Integrity- will be achieved if the
databases data in it satisfies all
established integrity constraints.
Security is the prevention of unauthorized
access to the database.
Data independence, which is a property
that lets you change the structure of a
database without requiring you to change
the programs that access the database.
Disadvantages of Using Database
-Larger file size
-Increased complexity
-Greater impact of failure
-More difficult recovery
CHAPTER II Relational Model 1
Relation- is a two-dimensional table in
which:
1. The entries in the table are singlevalued;
2. Each column has a distinct name
(technically called the attribute name).
3. All values in a column are values of the
same attribute (that is, all entries must
match the column name).
4. The order of columns is immaterial.
5. Each row is distinct.
6. The order of rows is immaterial.
Relational database is a collection of
relations.
Unnormalized relation- some of the
entries contain repeating groups and thus
are not single- valued.
Rows in a table are often called records or
tuples.
Columns in a table are often called fields
or attributes.

Primary key of a table is the column or


collection of columns that uniquely
identifies a given row in that table.
Query is simply a question represented in
a way that the DBMS can recognize and
process.
Query-By-Example (QBE) is a visual
tool for manipulating relational databases.
QBE queries are created by completing
on-screen forms.
Design grid, the area in which you
specify the format of your output, the
fields to be included in the query results, a
sort order for the query results, and any
criteria the records you are looking for
must satisfy.
Criteria conditions that data must satisfy.
Criterion- a single condition.
Relational
operatorcomparison
operator must be used if you want
something other than an exact match.
The comparison operators are:
= (equal to),
> (greater than),
< (less than),
>= (greater than or equal to),
<= (less than or equal to), and
NOT (not equal to).
Compound conditions are used when
creating combine criteria.
AND criterion, both criteria must be true
for the compound criterion to be true.
OR criterion, the overall criterion is true
if either of the individual criteria is true.
Computed field or calculated field is a

field that is the result of a calculation


using one or more existing fields.

Support the following built-in functions


(called aggregate functions in Access):
Count, Sum, Avg (average), Max (largest
value), Min (smallest value), StDev
(standard deviation), Var (variance), First,
and Last.
Grouping simply means creating groups
of records that share some common
characteristic.
Sort- to list the records in query results in
a particular way.
Sort key- the field on which records are
sorted.
*When you are sorting records by more
than one field:
Primary sort key/ major sort key the
first sort field
Secondary sort key/ minor sort key the
second sort field.
Join line a line, between matching fields
in the two tables, indicating that the tables
are related.

WHERE command- condition


PROJECT command- table
Includes OVER followed by lists of
columns to be included.
GIVING CLAUSE- clause requests the
result of the command to be placed in a
temporary table with the specified name.
Concatenation- combination
Union of tables A and B is a table
containing all rows that are in either table
A or table B or in both table A and table B.
The intersection of two tables is a table
containing all rows that are common in
both table A and table B. - INTERSECT
command
Union compatible when two tables are
have the same number of columns and
when their corresponding columns represent the same type of data.
SUBTRACT command in relational
algebra, it is performed by the difference
operation.
Cartesian product- the product of two
tables is the table obtained by concatenating every row in the first table with
every row in the second table.

Update Query a query that changes data.


CHAPTER 3: Relational Model 2: SQL
Delete query permanently deletes all the
records satisfying the criteria entered in
the query.
Make-table query creates a new table
using the results of a query.
Relational algebra is a theoretical way of
manipulating a relational database.
SELECT command - field

SQL (Structured Query Language)provides users with the capability of


querying a relational database.
Statement history as you are working in
MySQL, the most recent command you
entered is stored in a special area of
memory.
Queries the commands used to retrieve
table data .

** SQL was developed under the name


SEQUEL at the IBM San Jose research
facilities as the data manipulation
language for IBMs prototype relational
DBMS, System R, in the mid-1970s.
In 1980, it was renamed SQL (but still
pronounced sequel,
CREATE TABLE command - table
creation
Some common restrictions placed on
table and column names by DBMSs are as
follows:
The names cannot exceed 18 characters.
The names must start with a letter.
The names can contain only letters,
numbers, and underscores (_).
The names cannot contain spaces.
Type of Data where a column can store
-Integer
-SmallInt
-Decimal
-CHAR
-Date
INTEGER: Stores integers, which are
numbers without a decimal part. The valid
data
range
is
-2147483648
to
2147483647.
SMALLINT: Stores integers, but uses
less space than the INTEGER data type.
The valid data range is -32768 to 32767.
DECIMAL(p,q): Stores a decimal
number p digits long with q of these digits
being decimal places. For example,
DECIMAL(5,2) represents a number with
three places to the left and two places to
the right of the decimal.
Use the CURRENCY data type for
fields that will contain currency values;
use the NUMBER data type for all other

numeric fields.
CHAR(n): Stores a character string n
characters long. You use the CHAR type
for fields that contain letters and other
special characters and for fields that
contain numbers that will not be used in
calcualtions.
DATE: Stores dates in the form DDMON-YYYY or MM/DD/YYYY. For
example, May 12, 2010, could be stored
as 12-MAY-2010 or 5/12/2010.
SELECT-FROM-WHERE is the basic
form of an SQL retrieval command.
SELECT Clause- fields the
* symbol indicates that you want to
include all fields.
FROM Clause- from what table does the
fields came
WHERE Clause- condition/s
Reserved words this text uses a common style in which words that are part of
the SQL language appear in all uppercase
letters.
Simple condition includes the field name,
a comparison operator, and either another
field name or a value, such as
CreditLimit=10000orCreditLimit>Balanc
e
Comparison Operator Meaning
= Equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
< > Not equal to (used by most
implementations of SQL)
!= Not equal to (used by some
implementations of SQL)

Compound condition is formed by


connecting two or more simple conditions
using one or both of the following
operators: AND and OR, NOT.
AND operator, all the simple conditions
must be true for the compound condition
to be true.
When you connect simple conditions
using the OR operator, the compound
condition will be true whenever any of the
simple conditions are true.

UPDATE command- table to be updated


SET- Change to be made
INSERT command to add new data to a
table.
After the words INSERT INTO, you list
the name of the table, followed by the
word VALUES.
DELETE command- to delete data from
the database, use the which consists of
the word DELETE followed by a FROM
clause identifying the table.

Preceding a condition by the NOT


operator reverses the truth or falsity of
the original condition.

CHAPTER IV RELATIONAL MODEL


3

Computed field or calculated field it is a


field whose values you derive from
existing field. Computed fields can
involve addition (+), subtraction (-),
multiplication (*), or division (/).

View- An application programs or an


individual users picture of database.Use
to create reports, charts and other objects
using database data.Provides measure of
security

LIKE operators you might know only


that the desired value contains a certain
collection of characters.

Indexes- The main mechanism for


increasing the efficiency with which data
is retrieved from the database.

IN operators- provides a concise way of


phrasing certain conditions

Single-field index index whose key is a


single field.

You can do so by placing one query inside


another. The inner query is called a
subquery and is evaluated first.

Multiple-field index (also called a


multiple-column index) is an index with
more than one key field.

Grouping means creating groups of


records that share some common
characteristic. GROUP BY CLAUSE

DROP INDEX the SQL command used


to drop (delete) an index that is no longer
necessary.

ORDER BY clause to display the query


results in a particular order.

Security- the prevention of unauthorized


access to the database.

HAVING clause is to groups what the


WHERE clause is to rows.

GRANT statement that different


privileges can be granted to users and if
necessary later revoked.

REVOKE revoke privileges statement.


Nulls are used when a value is missing,
unknown, and inapplicable.
PRIMARY KEY is the type of field for
which you should never allow nulls.
PRIMARY KEY is the column or
collection of columns that uniquely
identifies a given row in a table.
Entity integrity is the restriction that the
primary key cannot allow null values.
FOREIGN KEY- is a field or collection
of fields in a table whose value is required
to match the value of the primary key for
the second table.
Referential integrity is the rule that if
table A contains a foreign key that
matches the primary key of table B, the
values of this foreign key must match the
value of the primary key for some row in
table B or be null.
Legal-Values Integrity- The property that
states that no record can exist in the
database with a value in the field other
than one of the legal values.
Legal values- Particular set of values.
System CatalogThe
system
catalog is a collection of tables and views
that contain important information about a
database.
Documenter- It allows us to print detailed
documentation about any table, query,
report, form, or other object in the
database.

Stored procedure is a sequence of


program instructions that perform a
specific task available to applications that
access a relational database system.
Server- is database resides on a computer.
Client- is a computer that is connected to
a network and has access through the
server to the database.
Delimiter- is a character that identifies the
beginning or the end of a character string.
Trigger is an action actions that occurs
automatically in response to an associated
database operation
CHAPTER 5
Normalization

Database

Design

1:

The normalization process enables you


to identify the existence of potential
problems, called update anomalies, in the
design of a relational database.This
process also supplies methods for
correcting these problems.
A column (attribute) B is functionally
dependent on another column A (or
possibly a collection of columns) when
each value for A in the database is
associated with exactly one value of B.
The primary key is a column (or a
collection of columns) A such that all
other columns are functionally dependent on A and no subcollection of the
columns in A also has this property.
When there is more than one choice for
the primary key, one of the possibilities is
chosen to be the primary key.The others
are referred to as candidate keys.

A table (relation) is in first normal form


(1NF) when it does not contain repeating
groups.
A column is a nonkey column (also
called a nonkey attribute) when it is not
a part of the primary key.
A table (relation)
normal form (2NF)
normal form and no
dependent on only
primary key.

is in the second
when it is in first
nonkey column is
a portion of the

A determinant is any column that


functionally determines another column.
A table (relation) is in third normal
form (3NF) when it is in second normal
form and the only determinants it contains
are candidate keys.
A collection of tables (relations) that is
not in third normal form has inherent
problems called update anomalies.
Replacing this collection with an
equivalent collection of tables (relations)
that is in third normal form removes these
anomalies.
A table (relation) is in fourth normal
form (4NF) when it is in third normal
form and there are no multivalued
dependencies

S-ar putea să vă placă și