Sie sind auf Seite 1von 7

Review Terms:

Table A collection of closely related columns. A table consists of rows each of


which shares the same columns but vary in the column values.
Tuple variables- can be used in SQL, and are defined in the from clause:
select distinct cname, T.loan#

from borrower as S, loan as T

where S.loan# = T.loan#

Relation- database relation is a predefined row/column format for storing
information in a relational database. Relations are equivalent to tables.
Null Value- the NULL SQL keyword is used to represent either a missing value or a
value that is not applicable in a relational table.
Database schema- a way to logically group objects such as tables, views, stored
procedures etc. You can assign a user login permissions to a single schema so that
the user can only access the objects they are authorized to access.
Database Instance An independent database which shares the same schema as
another database. Only used in RDM Server.
Relation schema- the logical definition of a table - it defines what the name of the
table is, and what the name and type of each column is. It's like a plan or a
blueprint. A database schema is the collection of relation schemas for a whole
database.

Relation instance- concrete table content.
Set of tuples (also called records) matching the schema.

Keys:
Key constraint: certain minimal subset of fields is a unique identifier for a
tuple.
Candidate key minimal set of fields that uniquely identify each tuple in a
relation.
Primary key- one candidate key can be selected as primary key
Foreign key- field that refers to tuples in another relation. Typically, this field
refers to the primary key of other relation.
Can pick another field as well.

Schema diagram- all database tables are designated with unique columns and
special features, e.g., primary/foreign keys or not null, etc.
Query language- is an industry-standard language used for manipulation of data
in a relational database. The major SQL commands of interest to database users
are SELECT, INSERT, JOIN and UPDATE.

Procedural language- a type of computer programming language that specifies a
series of well-structured steps and procedures within its programming context to
compose a program. It contains a systematic order of statements, functions and
commands to complete a computational task or program.

Non-procedural language- (also called a declarative language) requires the
programmer to specify what the program should do, rather than (as with
a procedural language) providing the sequential steps indicating how the program
should perform its task(s).

Relation algebra- is a residuated Boolean algebra expanded with
an involution called converse, a unary operation.


Relation Algebra Operations:
Selection ( ) Selects a subset of rows from relation.
Projection ( ) Deletes unwanted columns from relation.
Cross-product ( ) Allows us to combine two relations.
Set-difference ( ) Tuples in reln. 1, but not in reln. 2.
Union ( ) Tuples in reln. 1 and in reln. 2

Selection: condition(S)
Condition is Boolean combination (,) of terms
Term is: attr. op constant, attr. op attr.
Op is: <, <=, =, , >=, or >

Projection: list-of-attributes(S)- is a unary operation written
as where is a set of attribute names. The result of such
projection is defined as the set obtained when the components of the tuple are
restricted to the set it discards (or excludes) the other attributes.

Union (), Intersection ()
Set difference ()-is the set of elements in B, but not in A. The relative
complement of A in B is denoted B A according to the ISO 31-11
standard (sometimes written B A, but this notation is ambiguous, as in some
contexts it can be interpreted as the set of all b a, where b is taken
from B and a from A).
Formally





Cross-product or cartesian product ()- a mathematical operation which returns
a set (or product set or simply product) from multiple sets. That is, for
sets A and B, the Cartesian product A B is the set of all ordered pairs (a,
b) where a A and b B. Products can be specified using set-builder notation,
e.g. pair builder


Join: R S = (R S)
Division: R/S, Rename (R(F),E)- a rename is a unary operation written
as where:
is a relation
and are attribute names
is an attribute of .

Additional Operations:
Natural join ( )- is a binary operator that is written as (R S)
where R and S are relations.
[2]
The result of the natural join is the set of all
combinations of tuples in R and S that are equal on their common attribute
names.
Intersection, join, division, renaming: Not essential, but
(very!) useful.
Assignment operation- is a process in imperative programming in which different
values are associated with a particular variable name as time passes.
Extended relational-algebra operations:
Generalized Projection- Extends the projection operation by allowing arithmetic
functions to be used in the projection list.

F1, F2, , Fn
(E)
E is any relational-algebra expression
Each of F
1
, F
2
, , F
n
are are arithmetic expressions involving constants and
attributes in the schema of E.
Given relation credit-info(customer-name, limit, credit-balance), find how much
more each person can spend:

customer-name, limit credit-balance


(credit-info)

Outer join- contains those tuples and additionally some tuples formed by
extending an unmatched tuple in one of the operands by "fill" values for each of
the attributes of the other operand.
Left outer join- is written as R S where R and S are relations. The result of the
left outer join is the set of all combinations of tuples in R and S that are equal on
their common attribute names, in addition (loosely speaking) to tuples in R that
have no matching tuples in S.
Right outer join- behaves almost identically to the left outer join, but the roles of
the tables are switched. The right outer join of relations R and S is written
as R S. The result of the right outer join is the set of all combinations of tuples
in R and S that are equal on their common attribute names, in addition to tuples
in S that have no matching tuples in R.

Aggregation function takes a collection of values and returns a single value as a
result.
avg: average value
min: minimum value
max: maximum value
sum: sum of values
count: number of values
Aggregate operation in relational algebra:

G1, G2, , Gn
g
F1( A1), F2( A2),, Fn( An)
(E)
H E is any relational-algebra expression
H G
1
, G
2
, G
n
is a list of attributes on which to group (can be empty)
H Each F
i
is an aggregate function
H Each A
i
is an attribute name

Multiset- is an extension of the concept of a set. While a set can contain only one
occurrence of any given element, a multiset may contain multiple occurrences of
the same element.

Summarizing data from database file records (Grouping):
The group processing function allows you to summarize data from existing
database records. You can specify:
The grouping fields
Selection values both before and after grouping
A keyed sequence access path over the new records
Mapped field definitions that allow you to do such functions as sum,
average, standard deviation, and variance, as well as counting the records
in each group
The sort sequence and language identifier that supply the weights by which
the field values are grouped.

Truth table- is a breakdown of a logic function by listing all possible values the
function can attain. Such a table typically contains several rows and columns, with
the top row representing the logical variables and combinations, in increasing
complexity leading up to the final function.

Modification of the database:
INSERT-In its simplest form, it is used to add one or more tuples to a relation.
Attribute values should be listed in the same order as the attributes were
specified in the CREATE TABLE command.
DELETE- Removes tuples from a relation. Includes a WHERE-clause to select the
tuples to be deleted.
-Tuples are deleted from only one table at a time (unless CASCADE is specified on
a referential integrity constraint).
-A missing WHERE-clause specifies that all tuples in the relation are to be deleted;
the table then becomes an empty table.
- The number of tuples deleted depends on the number of tuples in the relation
that satisfy the WHERE-clause.
-Referential integrity should be enforced.

UPDATE- Used to modify attribute values of one or more selected tuples.
-A WHERE-clause selects the tuples to be modified.
-An additional SET-clause specifies the attributes to be modified and their new
values.
-Each command modifies tuples in the same relation.
-Referential integrity should be enforced

Das könnte Ihnen auch gefallen