Relational Algebra and SQL Queries Notes for GATE DA: Concepts, Formulas, Worked Examples & Practice

    Relational Algebra and SQL Queries notes for GATE DA: 53 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Chapter Roadmap: Relational Algebra and SQL Queries

    Your Learning Journey
    1

    Relational Algebra & Semantics

    Formal query language using mathematical operations. Highest weightage topic.

    2

    SQL Joins, Aggregation & Grouping

    Practical SQL implementation with table combinations and summary computations.

    3

    SQL Subqueries & Evaluation

    Nested queries and execution semantics. Understand internal processing.

    By the end of this chapter, you will:
    • Write queries in both relational algebra and SQL
    • Predict query results for any given database instance
    • Understand join semantics and aggregation behavior
    • Analyze nested queries and their execution order

    What is Relational Algebra?

    The Core Idea

    Relational algebra is a procedural query language that operates on relations (tables) to produce new relations.

    InputOne or two relations
    OutputA new relation (table)
    ProceduralSpecifies how to get the result
    ComposableOutput becomes next input

    The Six Fundamental Operations

    OperationSymbolPurpose
    SelectFilter rows
    ProjectFilter columns
    UnionCombine rows
    DifferenceRemove rows
    ProductAll combinations
    RenameRename attrs

    Select Operation: Filtering Rows

    Select (): Row Filter

    • R = input relation
    • condition = predicate using attributes of R
    • Output = subset of rows satisfying condition
    • Schema (columns) remains unchanged

    Example

    Relation: Employee(EmpID, Name, Salary, Dept)

    SELECT * FROM Employee WHERE Salary > 50000 AND Dept = 'IT';
    Select does not change the schema. It only reduces the number of tuples (rows).

    Project Operation: Filtering Columns

    Project (): Column Selector

    • Output has only specified columns
    • Duplicates are automatically removed (relation is a set)
    Critical Point: Since a relation is a set, project removes duplicate tuples. This is different from SQL's SELECT without DISTINCT.

    Example

    Before ProjectAfter
    (Alice, IT, 60k)(Alice, IT)
    (Bob, HR, 55k)(Bob, HR)
    (Alice, IT, 70k)(Alice, IT)

    More notes in this unit

    chapter
    Relational Algebra and SQL Queries Notes for GATE DA: Concepts, Formulas, Worked Examples & Practice

    Relational Algebra and SQL Queries notes for GATE DA: 53 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Free preview ends here

    Login to view the complete notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.