Skip to main content

Relational Algebra Sandbox

ValidSnapshot v1

Design schemas below, then evaluate expressions against the active snapshot (Lesson Schema).

Operator palette

Selection (Restrict)Fundamental

Filters tuples from relation R that satisfy the proposition P under 3VL logic.

Guide
ProjectionFundamental

Extracts specified attributes and eliminates duplicate tuples from the result.

Guide
Relation RenameFundamental

Assigns an alias to an intermediate relation to prevent ambiguity in self-joins.

Guide
Attribute RenameFundamental

Renames specific attributes within relation R while preserving tuple data.

Guide
Cartesian Product (Cross Join)Fundamental

Produces all possible tuple pairings between relations R and S.

Guide
Natural JoinDerived

Equi-join on all identically named attributes between R and S, projecting duplicate columns.

Guide
Theta Join (Conditional Join)Derived

Combines tuples from R and S that satisfy join condition θ.

Guide
Left Outer JoinJoinVariant

Preserves all tuples from the left relation R, padding unmatched right attributes with NULL.

Guide
Right Outer JoinJoinVariant

Preserves all tuples from the right relation S, padding unmatched left attributes with NULL.

Guide
Full Outer JoinJoinVariant

Preserves all tuples from both relations R and S, padding non-matching sides with NULL.

Guide
Set UnionFundamental

Combines distinct tuples from union-compatible relations R and S.

Guide
Set IntersectionDerived

Yields tuples appearing in both union-compatible relations R and S.

Guide
Set DifferenceFundamental

Yields tuples belonging to relation R that do not appear in union-compatible relation S.

Guide
Relational DivisionDerived

Universal quantification operator: finds tuples in R(A - B) associated with all tuples in S(B).

Guide

Each operator inserts a syntax template with editable placeholders. Use Ctrl+Shift+O (⌘⇧O on Mac) to focus this palette from the editor.

Operator reference

Full guide →
  • σSelection (Restrict)

    σ <predicate> ( R )

    Read

    Filter rows before projecting or joining so intermediate results stay small and readable.

  • πProjection

    π <a1, a2, …> ( R )

    Read

    Drop unused columns and collapse duplicate rows after joins or unions.

  • ρRelation rename

    ρ Alias ( R )

    Read

    Self-joins and comparisons between two uses of the same base table.

  • ρAttribute rename

    ρ[old → new] ( R )

    Read

    Align column names before union or clarify labels after a join.

  • ⨯Cartesian Product (Cross Join)

    R ⨯ S

    Read

    Build a wide intermediate relation before σ or ⋈_θ when no shared column names exist.

  • ⋈Natural Join

    R ⋈ S

    Read

    Foreign-key style links when column names already match (e.g., dept_id on both sides).

  • ⋈_θTheta Join (Conditional Join)

    R ⋈[θ] S

    Read

    Join predicates that are not limited to identically named columns.

  • ⟕Left Outer Join

    R ⟕[θ] S

    Read

    Keep every left row even when the right side has no match (optional relationships).

  • ⟖Right Outer Join

    R ⟖[θ] S

    Read

    Mirror of left outer join when the preserved side should be the right operand.

  • ⟗Full Outer Join

    R ⟗[θ] S

    Read

    Full coverage when you need unmatched rows from both operands.

  • ∪Set Union

    R ∪ S

    Read

    Merge compatible lists (e.g., names drawn from two relations).

  • ∩Set Intersection

    R ∩ S

    Read

    Overlap queries (“students in both courses”).

  • −Set Difference

    R − S

    Read

    Anti-join patterns and “rows in A but not B”.

  • ÷Relational Division

    R ÷ S

    Read

    “For all” queries—students who took every required course, suppliers who ship every part, etc.

Expression Editor
Expression valid
Expression valid

No issues found for the current snapshot.

Relations: Departments, Employees · Attributes: dept_id, dept_name, emp_id, name

Press Control Space for autocomplete, Control Shift O to focus the operator palette, or Control slash to open keyboard shortcuts help.

Live validation against snapshot v1
Enter an expression, then run to evaluate against the snapshot.
Active snapshot

Immutable copy v1 · 2 relations

Employees (2 rows)
Departments (2 rows)