NAME : KHUNT MIHIR
ENROLLMENT NO. : 196170307055
SEM : 3rd A
BRANCH : COMPUTER ENGINEERING
DBMS ASSIGNMENT-10
1. Define Tuple, Tuple Variable, Attributes and Domain.
Tuple :
- A row in a relation is referred as a tuple. So, a relation can also be
considered as a set of tuples.
Tuple variable :
- A tuple variable is variable that takes on tuples of a particular
relation schema as values. That is, every value assigned to a
given tuplevariable has the same number and type of fields.
Attribute :
- An attribute is a name of a column in a relation.
- For example, attributes of a relation Customer are cid, name,
society and city.
- Similarly, attributes of a relation Account are ano, balance and
branch.
Domain :
- A domain of an attribute is a set of permitted values for that
attribute.
- For example, if the bank is organized in three branches, named
‘vvn’, ‘ksd’ and ‘anand’, then the domain of attribute branch is
{‘vvn’,’ksad’,’anand’}.
- A value for a branch name is must be one of these three values of
any relation.
2. Define Super Key, Relation key, Candidate Key, Primary Key,
Alternate key.
Super key :
- A super key is a set of one or more attributes that allows to
identify each tuple uniquely in a relation.
- For example, consider a relation Customer with attributes cid,
cname, address and contact_no. In this relation, each tuple
represents an individual customer.
- Here, the cid attribute can distinguish each tuple from another.
So, cid is a super key for Customer relation.
Relation key :
- A super key for which no subset is a super key is called a relation
key.
- In other words, relation key is a minimal super key.
- A relation key is also referred as ‘key; only.
- A relation key is sufficient to identify each and every tuple
uniquely within a relation.
- For example, combination of cid and contact_no is a super key for
relation Customer. But, only cid can identify entities uniquely. So,
here contact_no is a redundant attribute in super key.
- After removing all such redundant attributes from a super key, the
remaining attributes are considered as a candidate key.So, here
cid is a relation key.
- A relation key can’t have any duplicate values.
Candidate key :
- If a relation contains more than one relation keys, they each are
called candidate key.
- For example, for Customer relation, {cid} as well as
{cname,address} are relation keys. And so, they each are called as
candidate keys.
Primary key :
- A primary key is a candidate key that is chosen by the database
designer to identify tuples uniquely in a relation.
- For example, if database designers choose candidate key cid to
identify all customers uniquely, then cid is a primary key of the
relation.
Alternate key :
- An alternate key is a candidate key that is not chosen by the
database designer to identify tuples uniquely in a relation.
- For example, if database designers choose candidate key cid to
identify all customers uniquely, then another candidate key
{cname,address} is an alternate key.
3. Categorize relational algebra operations.
Relational algebra operations can be categorized into two
categories :
- Fundamental operations :
Select
Project
Union
Set-difference
Cartesian product
Rename
- Secondary operations :
Set-intersection
Natural join
Division
Assignment
Based on the number of input relations, these operations can
also be categorized as given below :
- Unary operations :
These operations operate on single relation.
E,g.; Select, Project and Rename operations.
- Binary operations :
These operations operate on pairs of relations.
E,g.; Union, Set-difference, Set-intersection, Cartesian
product, etc.
Some operations use the concept of set theory of mathematics.
Based on this concept, these operations can be categorized as
below :
- Set-theoretic operations :
Relations are essentially sets of rows.
E,g.; Union, Set-difference, Cartesian product.
- Naive relational operations :
These operations focus on the structures of the rows.
E,g.; Select, Project, Natural join, Division,etc.
4. Write two necessary condition for set operations.
Two necessary conditions are given below to perform set
operation between two relation :
- Both relation must have same number of arity(column).
- The arities(columns) must have same data-type.
5. Explain Rename operation with example.
RENAME OPERATION :
- Rename operation renames the relation(table) as well as
attributes.
Symbol :ρ (rho)
Notation :
- ρABC(XYZ)=> This will rename the relation XYZ to ABC.
- ρABC(C1,C2,…,Cn)(XYZ) => This will rename the relation XYZ to ABC and
its attributes to C1,C2,…,Cn.
Example :
- ∏(a1.balance)(σa1.balance<a2.balance (ρa1 (Account) ˟ρa2
(Account)))
a1.balance
----------
550
600
650