-1

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?

philipxy
  • 14,867
  • 6
  • 39
  • 83
Primer Cielo
  • 113
  • 5
  • There are many RAs (relational algebras). They differ in operators & even what a relation is. Give operator definitions & your reference for yours. Eg textbook name, edition & page. PS "related information" & based on" don't mean anything in particular. Neither sorting nor aggregation are needed to find the MIN or MAX of an attribute in a relation via a relational algebra. (How to do it is a faq.) But you don't actually clearly say what you are trying to do that led to the question you actually asked. [What is the XY problem?](https://meta.stackexchange.com/q/66377/266284) [mre] [ask] [Help] – philipxy Jul 02 '22 at 05:57
  • Please before considering posting read the manual/reference & google any error message & many clear, concise & precise phrasings of your question/problem/goal, with & without your particular names/strings/numbers, 'site:stackoverflow.com' & tags; read many answers. Reflect research in posts. SO/SE search is poor & literal & sometimes limited to titles, but read the help. Google re googling/searching, including in Q&A at [meta] & [meta.se]. [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/3404097) [ask] [Help] – philipxy Jul 02 '22 at 06:07
  • [Algebra Relational sql GROUP BY SORT BY ORDER BY](https://stackoverflow.com/q/28665635/3404097) [Ordering from largest to smallest in relational algebra](https://stackoverflow.com/q/26283943/3404097) [Aggregate Relational Algebra (Maximum)](https://stackoverflow.com/q/4952451/3404097) [How can I find MAX with relational algebra?](https://stackoverflow.com/q/5493691/3404097) [Query using aggregation and/or groups in relational algebra - count, max, min, etc](https://stackoverflow.com/q/15660545/3404097) – philipxy Jul 02 '22 at 06:13

1 Answers1

0

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.

Bart Barnard
  • 1,128
  • 8
  • 17
  • Please clarify via edits, not comments. Please put what is needed to answer in your post, not just at a link. Paraphrase or quote from other text with credit. Give just what you need & relate it to your problem. – philipxy Jul 02 '22 at 05:49