#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · DBMS PRACTICE

Relational Algebra Calculator: Run σ, π and ⋈ on Real Tables

Define small tables, write a relational algebra expression and see the result table and equivalent SQL.

  • σ π ⋈ ∪ − ∩ × ρ
  • 🗃️ Your own tables
  • 🔁 Equivalent SQL

How to use the Relational Algebra Calculator

  1. 1. Define tablesA header like Students(sid, name, city), then one row per line.
  2. 2. Write an expressionWith symbols like σ and π, or words like select and project.
  3. 3. EvaluateSee the result table and roughly equivalent SQL.

Supported operations

  • σ[condition](R) or select: keep rows that match, such as σ[city = 'Noida' and sid > 1](Students).
  • π[columns](R) or project: keep chosen columns and remove duplicate rows.
  • R ⋈ S or join: natural join on columns with the same name. R ⋈[condition] S is a theta join.
  • R ∪ S, R − S and R ∩ S: union, difference and intersection of compatible relations.
  • R × S: Cartesian product.
  • ρ[N](R): rename, so a table can be joined with itself.

Conditions support =, <>, <, >, <= and >=, joined with and, or and not. They're read by a small parser, never run as code. Use Table.column when a column name appears in both tables.

Worked example

The sample has Students (4 rows) and Enrolled (5 rows). The question "names and cities of students taking DBMS" is:

π[name, city](σ[course = 'DBMS'](Students ⋈ Enrolled))

The natural join matches on sid, giving 5 rows; σ keeps the 2 with course DBMS; π keeps name and city. The result is 2 rows: Asha, Noida and Meera, Noida.

Now try π[sid](Students) − π[sid](Enrolled) to find students not enrolled in anything (none here), or π[sid](σ[course = 'DBMS'](Enrolled)) ∩ π[sid](σ[course = 'Python'](Enrolled)) to find students taking both: just sid 3. The rough SQL translation helps you connect exam-style algebra to the queries you'll write at work.

Frequently asked questions

Why does π remove duplicates?

Relational algebra works on sets, which have no duplicates. SQL keeps duplicates unless you add DISTINCT.

Is division (÷) supported?

Not directly. Write it with − and ×, the standard way to express division in basic operators.

How many rows can my tables have?

Small practice tables of up to a few hundred rows work well.

Is the relational algebra calculator free to use?

Yes, the relational algebra calculator is free and costs nothing. Your first evaluation shows a short form for your name and WhatsApp number one time; once that's done, this tool and every other Uncodemy tool open with no form.

More free tools

See all free tools