9.2 n-ary Relations and their Applications Flashcards
(34 cards)
n-ary Relations and its degree and its domains:
Let A1, A2, … , An be sets. An n-ary relation on these sets is a subset of A1 × A2 × ⋯ × An.
The sets A1, A2, … , An are called the domains of the relation, and n is called its degree.
a ≡ b (mod m)
Integer a is congruent to integer b modulo m > 0, if a and b give the same remainder when divided by m.
The notation a ≡ b (mod m).
( Alternative defnition: a ≡ b (mod m)
= m|(b −a). idk)
The time required to manipulate information in a database depends on?
The time required to manipulate information in a database depends on how this information is
stored.
Fields:
entries of n-tuple.
Records:
n tuples made up of fields.
Database:
It consists of records.
The relational data Model:
The relational
data model represents a database of records as an
n-ary relation.
Relation used to represent databases:
describe it, what are attributes?
Tables.
Each column corresponds to an attribute of the database.
Attribute = Column Name
Primary Key:
A domain of an n-ary relation is called a primary key when the value of the n-tuple from
this domain determines the n-tuple. That is, a domain is a primary key when no two n-tuples in
the relation have the same value from this domain.
Intension and extension:
The more permanent part of a database, including the
name and attributes of the database is called its intension.
The foll collection of n-tuples in a relation
is called the extension of the relation.
(Ackermann, 231455, Computer Science, 3.88)
(Adams, 888323, Physics, 3.45)
The property that a domain is a primary key is permanent?
Records are often added to or deleted from databases. Because of this, the property that a
domain is a primary key is time-dependent.
To make it permanent, it must serve as primary key to all possible extensions To do so, its required to analyze intentions to understand possible n tuple that can occur as extension.
Composite Key:
Combinations of domains can also uniquely identify n-tuples in an n-ary relation. When
the values of a set of domains determine an n-tuple in a relation, the Cartesian product of these
domains is called a composite key
Selection Operator:
Let R be an n-ary relation and C a condition that elements in R may satisfy. Then the selection
operator sC maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy
the condition C.
Projections:
Projections are used to form new n-ary relations by deleting the same fields in every record
of the relation.
The projection P i1 i2,…,im where i1 < i2 < ⋯ < im, maps the n-tuple (a1, a2, … , an) to the
m-tuple (ai1, ai2, … , aim ), where m ≤ n.
In other words, the projection P i1 ,i2,…,im DELETES
n − m of the components of an n-tuple, leaving
the i1th, i2th, … , and imth components
P1,3 (a1, a2, a3, a4) = ( a1, a3)
Projections are formed by omitting certain columns, and then eliminating duplicate
rows.
Does the application of projection ever lead to fewer rows?
Fewer rows may result when a projection is applied to the table for a relation. This happens
when some of the n-tuples in the relation have identical values in each of the m components of
the projection, and only disagree in components deleted by the projection.
The join Operator:
Let R be a relation of degree m and S a relation of degree n. The join Jp(R, S),
where p ≤ m and p ≤ n, is a relation of degree m + n − p that consists of all
(m + n − p)-tuples (a1, a2, … , am−p, c1, c2, … , cp, b1, b2, … , bn−p), where the m-tuple
(a1, a2, … , am−p, c1, c2, … , cp) belongs to R and the n-tuple (c1, c2, … , cp, b1, b2, … , bn−p)
belongs to S.
In other words, the join operator Jp produces a new relation from two relations by combining all
m-tuples of the first relation with all n-tuples of the second relation, where the last p components
of the m-tuples agree with the first p components of the n-tuples.
Joins are analogous to compositions of relations.
SQL:
Structured Query Language
Queries in SQL:
SQL uses the FROM clause to identify the n-ary relation the query is applied to, the
WHERE clause to specify the condition of the selection operation, and the SELECT clause to
specify the projection operation that is to be applied. (Beware: SQL uses SELECT to represent
a projection, rather than a selection operation. This is an unfortunate example of conflicting
terminology.)
SELECT Departure_time, Destination
FROM Flights, Table 2
WHERE Destination=’Detroit’
From table1, table2
to perform join operation.
Data Mining:
The discipline with the goal to get useful information from the data.
By a transaction what do you mean?
By a transaction we mean a set of items bought by a customer during a visit to the store,
such as {milk, eggs, bread} or {orange juice, bananas, yogurt, cream}.
Store collects large databases of transactions.
Item:
Each product in the store is called an item.
ItemSet:
k-itemset:
Collection of itemset.
A k-itemset is an itemset that contains exactly k items.
Transaction and basket:
The terms transaction and basket are
used synonymously with the word itemset.
What forms a database of transactions:
and how is a transaction represented?
When a store has n items, a1, a2, … , an, for sale,
each transaction can be represented by an n-tuple b1, b2, … , bn, where bi is a binary variable
that tells us whether ai occurs in this transaction. That is, bi = 1 if ai is in this transaction and
bi = 0 otherwise. (Note that we only care whether an item occurs in a transaction and not how
many times it occurs.) We can represent a transaction by an (n + 1)-tuple of the form (transaction number, b1, b2, … , bn). The collection of all these (n + 1)-tuples forms a database of
transactions