Questions tagged [relational-algebra]

For questions about the algebra of relational model theory, involving operations like Projection (π) Selection (σ), Rename (ρ), and Natural join (⋈).

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
1answer
739 views

Convert query in words to relational algebra

I have a follow-up question to a question I have previously asked on SO. Instead of the query from my initial question, I want to convert the following into relational algebra: List the names and ...
2
votes
0answers
43 views

Relational Algebra: how to express the combination of aggregation and projection?

Here I have a table, I would like to query the average salary of departments, the SQL statement should be select dept_name, avg(salary) from employee I try to express this SQL in relational algebra....
2
votes
0answers
472 views

How to write group by and having in a relational algebra interpreter?

I am practising writing relational algebra (RA) expressions in RA interpreter from Duke, but I can't figure out how to represent group by or having (from SQL). I have this expression, but I need to ...
2
votes
0answers
53 views

Converting from domain calculus to relational algebra

I have an assigned task at the uni and I have the three relations that follow: Customer (Name, City, Account) Offer (Product_Description, Supplier, Price) Order (Name, Product_Description, Quantity,...
2
votes
0answers
27 views

Do Selection attributes have to appear in Projection list in Relational Algebra

In extended relational algebra (aggregation being allowed) do you have to project all attributes that you use in a statement? So for example in the query below the attributes A.FO_ID and A.Arrival are ...
1
vote
0answers
22 views

Using relational algebra to check a condition for all

I encountered this question while revising for my finals exam on database theory. The following database contains information about car repair workshops. The following tables are used: Given two ...
1
vote
0answers
81 views

Equi Join On Union- and Intersection-Compatible Relations

Suppose that I have two union- and intersection-compatible relations; i.e., R1(A,B) and R2(C,D) as: Now , I want to find the join of both relations with equality conditions A=C and B=D. I have ...
1
vote
0answers
19 views

Finding Exclusive Pairings in Relational Algebra

classId | studentId 0 0 0 1 0 2 1 0 1 1 1 2 2 2 How do you find the pairs of students (s1, s2) that ONLY have classes with ...
1
vote
0answers
14 views

Relation Algebra: Selection of Cartesian Product

I am learning Relational Algebra basics for sql. I came across an example where the selection of cartesian product of two relations (R1 x R2) has been taken and I realize that it is same as selection(...
1
vote
0answers
102 views

Basic Relational Algebra Equivalence

The following relation schema: R(A,C), S(A,D), T(X,Y). Primary key attributes bold Would like to know why the following two are not equivalent queries Q1 = πA(σC<10(R)) and Q2 = σC<10(πA(R)) ...
1
vote
0answers
129 views

Relational Algebra Equivalence (basic)

I'm just getting started on an intro to databases course and have a question about writing relational algebra expressions. Schema: Person ( name, age, gender ) Frequents ( name, pizzeria ) Eats ( ...
1
vote
0answers
141 views

How to express inclusive and exclusive relations in relational algebra and relational calculus?

Let be the following simplified database sketch: R1(P,S),R2(S,T) and R3(T,S) with P= people S = Sport and T= Sports Center How to find in relational algebra and relational calculus which couples ...
0
votes
0answers
15 views

Relation algebra problem with renaming columns

I am trying to rename a 2 columns after joining them together ρ mmnr←MM.Kortnr, ebnr←EB.Kortnr π Passagerare.Namn, Passagerare.Personnr, MM.Kortnr, EB.Kortnr Passagerare ⟕ Passagerare.Personnr =EB....
0
votes
1answer
14 views

How can I calculate the cost of the query, if there is a `between` condition?

How can I calculate the cost of the query, if there is a between condition? Select * From A Where A.id between 10 and 50 If Index not exists and there is only one condition: Search in B+ tree to ...
0
votes
0answers
47 views

Relational Algebra - Remove duplicate tuples without count

I was wondering if there is a way to remove the tuples from a table using relational algebra that have the same Value occurring in multiple columns or same column multiple times e.g. I want to ...
0
votes
0answers
32 views

Delete duplicate keys with relation algebra without count

Hi I am new to relational algebra. I was wondering if there is a way to remove the tuples from a table using relational algebra that have the same Value occurring in multiple columns or same column ...
0
votes
0answers
100 views

Proof Full Outer Join associative and Commutative

I'm trying to prove to myself that the order of full outer joins doesn't matter, but, in an abstract sense, I'm coming up with nothing. How would one go about proving that the order of a set of FULL ...
0
votes
0answers
27 views

Write aggregate function in select predicate in relational algebra

Can i write aggregate function in select predicate in relational algebra? I am trying to find the maximum salary in the table Employee(name,salary) I am doing this to get max salary. σₛₐₗₐᵣᵧ=Gₘₐₓ₍...
-1
votes
2answers
156 views

How to reuse a relational algebra expression without using assignment operator?

Can I write the following expression (σθ(R1)) × (σθ(R1)) as (ρR2(σθ(R1))) × R2 ? The first expression is not efficient since I am doing the same operation twice. So, basically, I am looking for ...