describe the way you might use the relational algebra operations of Selection, P
ID: 3666687 • Letter: D
Question
describe the way you might use the relational algebra operations of Selection, Projection, and Joining to create new relations, that is, think of ways you might query your database that would require you to use Select, Project, or Join operations. Describe one query of your database that would use each of these operations. You may describe three separate queries, one for each operation, or you may combine more than one operation in a single query, as long as you are clear about how each operation you use will affect that query.
Explanation / Answer
Relational Algebra Operations:
Relational algebra is a procedural query language, which takes instances of relations as input and yields instances of relations as output. It uses operators to perform queries.
An operator can be either unary or binary. They accept relations as their input and yield relations as their output. Relational algebra is performed recursively on a relation and intermediate results are also considered relations.
The fundamental operations of relational algebra are as follows
->Select
->Project
->Union
->Set different
->Cartesian product
Select Operation ()
It selects tuples that satisfy the given predicate from a relation.
Notation p(r)
Where stands for selection predicate and r stands for relation. p is prepositional logic formula which may use connectors like and, or, and not. These terms may use relational operators like =, , , < , >, .
Project Operation ()
It projects column(s) that satisfy a given predicate.
Notation A1, A2, An (r)
Where A1, A2 , An are attribute names of relation r.
Duplicate rows are automatically eliminated, as relation is a set.
JOIN is used to combine related tuples from two relations:
In its simplest form the JOIN operator is just the cross product of the two relations.
As the join becomes more complex, tuples are removed within the cross product to make the result of the join more meaningful.
JOIN allows you to evaluate a join condition between the attributes of the relations on which the join is undertaken.
The notation used is
R JOINjoin condition S
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.