## DBMS Notes

Database Management System

Data Modeling

Database Architecture

Relational Model

Relational Algebra

Entity Relationship Model

Functional Dependencies

Normalization

Transaction And Concurrency Control

Deadlock

Files and Storage

Indexing

# Heading

Q

1

What is Relational Algebra?

Ans

Relational algebra is a procedural query language. It gives a step by step process to obtain the result of the query. It uses operators to perform queries.

Q

2

What is an expression?

Ans

An expression is a combination of data, operators and other functions which finally computes to obtain a value

Q

3

What are the basic operators in Relational Algebra?

Ans

"Selection operator (σ): Selection operator is used to select tuples from a relation based on some condition.

Syntax: σ (Cond)(Relation Name)

Projection Operator (∏): Projection operator is used to project particular columns from a relation.

Syntax:∏(Column 1,Column 2….Column n)(Relation Name)

Cross Product(X): Cross product is used to join two relations. For every row of Relation1, each row of Relation2 is concatenated. If Relation1 has m tuples and and Relation2 has n tuples, cross product of Relation1 and Relation2 will have m X n tuples.

Syntax:Relation1 X Relation2

Union (U): Union on two relations R1 and R2 can only be computed if R1 and R2 are union compatible (These two relation should have same number of attributes and corresponding attributes in two relations have same domain) . Union operator when applied on two relations R1 and R2 will give a relation with tuples which are either in R1 or in R2. The tuples which are in both R1 and R2 will appear only once in result relation.

Syntax: Relation1 U Relation2

Minus (-): Minus on two relations R1 and R2 can only be computed if R1 and R2 are union compatible. Minus operator when applied on two relations as R1-R2 will give a relation with tuples which are in R1 but not in R2.

Syntax:Relation1 - Relation2

Rename(ρ): Rename operator is used to give another name to a relation.

Syntax:ρ(Relation2, Relation1)"

Q

4

What are the extended (or derived) operators in Relational Algebra?

Ans

"Extended operators are those operators which can be derived from basic operators.There are mainly three types of extended operators in Relational Algebra:

1.Join

2.Intersection

3.Divide "

Q

5

Define Tuple Relational Calculus.

Ans

"Tuple Relational Calculus is a non-procedural query language unlike relational algebra. Tuple Calculus provides only the description of the query but it does not provide the methods to solve it. Thus, it explains what to do but not how to do.

In Tuple Calculus, a query is expressed as

{t| P(t)}

where t = resulting tuples,

P(t) = known as Predicate and these are the conditions that are used to fetch t

Thus, it generates set of all tuples t, such that Predicate P(t) is true for t.

P(t) may have various conditions logically combined with OR (∨), AND (∧), NOT(¬).

It also uses quantifiers:

∃ t ∈ r (Q(t)) = ”there exists” a tuple in t in relation r such that predicate Q(t) is true.

∀ t ∈ r (Q(t)) = Q(t) is true “for all” tuples in relation r."