relational-databaserelational-algebra

How to get ORDER BY clause representation in Relational Algebra?


I want to get account related information by using Relational Algebra based on the descending order of the balance attribute.

Table: Account (id, account_number, branch_name, balance)

How to get ORDER BY clause representation in Relational Algebra?


Solution

  • I don't think that is possible; relational algebra is about sets, which don't have an order. In this book on SQL and relation theory it is stated that "ORDER BY isn’t actually part of the relational algebra". Also, there's a quite thorough answer to a similar question on SO.