University of Melbourne · FACULTY OF INFORMATION TECHNOLOGY

INFO90002 Chap.5 Relational Algebra and SQL Foundations

- one subject, every graph, every model, every mark
5 Chapters3-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 5 of 12 · INFO90002

Relational Algebra and SQL Foundations

Relational Algebra and SQL Foundations turns selection and projection, joins and set and bag behaviour into executable reasoning. The chapter's practical target is to predict a query result from relational operations before running SQL, so every explanation should connect syntax to program state, control flow and observable output.

Treat selection and projection as a precise program object, not a loose label.

Identify its value or responsibility before execution, then trace what can read it, change it or depend on it. This makes hidden state changes visible before they become debugging guesses.

Databases relational databases

In INFO90002, databases relational databases belongs with selection and projection and joins because students use it to predict a query result from relational operations before running SQL.

A defensible use of databases relational databases should define the term, connect it to the case evidence and test the conclusion through set and bag behaviour; repeating the phrase without that chain does not demonstrate understanding.

Use joins to explain the program's next move. Work through one representative input by hand and name the branch, iteration or call that follows.

If the trace cannot be stated, the code may run by accident rather than by understood design.

Bring in set and bag behaviour as the test of structure.

Compare normal, boundary and invalid inputs; state the expected behaviour first; then use the mismatch between expectation and result to localise the defect.

For the application — predict a query result from relational operations before running SQL — write the smallest complete example that exposes the rule.

Explain why it works, what would break it and how the program should signal or recover from that failure.

Before running a Relational Algebra and SQL Foundations example, make a trace table with the important state before and after each operation. Include the value associated with selection and projection, the control decision governed by joins and the output or object affected by set and bag behaviour.

The table turns an unexplained result into a sequence that can be tested one transition at a time.

Test three inputs: an ordinary case, a boundary case and an invalid case. State the expected result for each before execution, then compare it with what the program actually does.

A useful test of joins isolates one rule; a test that changes several conditions at once cannot tell you which condition caused the failure.

Practise explaining the solution without reading the code. For INFO90002, name the data representation, the control flow, the responsibility of each function or class and the reason the chosen design supports predict a query result from relational operations before running SQL.

This rehearsal is especially important when a written test or interview asks why the program works rather than whether it produces one correct output.

A complete Relational Algebra and SQL Foundations response should make the task visible before the detail: identify what must be decided, define the relevant terms, connect the evidence to joins, and use set and bag behaviour to test the result.

The final sentence should answer the question actually asked rather than merely repeat the topic.

The controlling limit is specific: Sql duplicates and null logic can differ from pure set intuition.

Keep that limit beside the worked example, because it separates a careful INFO90002 answer from one that sounds confident but claims more than the task or evidence supports.

For revision, retrieve selection and projection, joins and set and bag behaviour without notes, explain their relationship aloud, then complete a changed version of the application: predict a query result from relational operations before running SQL.

Record the first point at which your reasoning fails and repair that move before attempting another case.

In this chapter

What this chapter covers

  • 01

    selection and projection

  • 02

    joins

  • 03

    set and bag behaviour

  • 04

    Applying selection and projection

  • 05

    Limits of joins and set and bag behaviour

Worked example · free

Worked example: Relational Algebra and SQL Foundations

Q [4 marks]. A draft chooses a response merely because selection and projection appears in a task about how to predict a query result from relational operations before running sql. Use joins and set and bag behaviour to test whether that choice is defensible. This is AskSia-authored practice, not a University question or marking scheme.
  • 1Extract the outcome, actor or operation that the Relational Algebra and SQL Foundations task actually requires.
  • 1State the precondition under which selection and projection is relevant rather than merely familiar.
  • 1Use joins to reject the nearest alternative, then run a failure-path check with set and bag behaviour.
  • 1Choose the response and state when it must be withdrawn or narrowed: Sql duplicates and null logic can differ from pure set intuition.
The choice follows from the task's required outcome and the precondition attached to selection and projection, not from keyword recognition. The response uses joins to distinguish the nearest alternative and set and bag behaviour tests the failure path. The response changes when this boundary is crossed: Sql duplicates and null logic can differ from pure set intuition.
Sia tip — Selection restricts rows; projection restricts columns; a join combines matching tuples. When translating to SQL, check duplicates and UNKNOWN from NULL explicitly, because SQL bag and three-valued behaviour can differ from pure relational set intuition.
Glossary

Key terms

normalisation
Normalisation decomposes relations according to functional dependencies to reduce redundancy and prevent insertion, update and deletion anomalies while preserving required information. In this chapter, use the concept when you predict a query result from relational operations before running SQL.
DDL, DML and DCL (CREATE/DROP/ALTER vs SELECT/INSERT/UPDATE/DELETE vs GRANT/REVOKE)
DDL defines database structures with commands such as CREATE, ALTER and DROP; DML queries or changes data with SELECT, INSERT, UPDATE and DELETE; DCL manages privileges with GRANT and REVOKE. In this chapter, use the concept when you predict a query result from relational operations before running SQL.
transactions, concurrency and locking
A transaction is a logical unit of database work that should satisfy ACID properties; concurrency control and locking coordinate simultaneous transactions to prevent inconsistent or lost updates. In this chapter, use the concept when you predict a query result from relational operations before running SQL.
FAQ

Relational Algebra and SQL Foundations FAQ

What is the main task in Relational Algebra and SQL Foundations?

Predict a query result from relational operations before running sql.

How do selection and projection and joins work together?

Use selection and projection to establish the object or condition, then use joins to explain how it changes the outcome being analysed.

What must a INFO90002 answer qualify here?

Sql duplicates and null logic can differ from pure set intuition.

How should I revise Relational Algebra and SQL Foundations?

Retrieve selection and projection, joins and set and bag behaviour, apply them to a changed case, and correct the first point where the evidence no longer supports the conclusion.

Study strategy

Exam move

Reconstruct the relationship among selection and projection, joins and set and bag behaviour; complete the chapter application without notes; then test the result against this limit: Sql duplicates and null logic can differ from pure set intuition.

Working through Relational Algebra and SQL Foundations in INFO90002? Sia is AskSia’s AI Information Technology tutor — ask any INFO90002 Relational Algebra and SQL Foundations question and get a clear, step-by-step explanation grounded in how INFO90002 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 126 of your University of Melbourne subjects - and 1,000+ Bibles across every Australian university.
Sia - your INFO90002 tutor, unlimited, worked the way the exam marks it
The full 3-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works