Aggregate Functions, Conservative Extension, and Linear Orders

  • Leonid Libkin
  • Limsoon Wong
Part of the Workshops in Computing book series (WORKSHOPS COMP.)


Practical database query languages are usually equipped with some aggregate functions. For example, “find mean of column” can be expressed in SQL. However, the manner in which aggregate functions were introduced in these query languages leaves something to be desired. Breazu-Tannen, Buneman, and Wong [3] introduced a nested relational language NRC(=) based on monads [16, 24] and structural recursion [1, 2]. It was shown in Wong [27] that this language is equivalent to the nested relational algebras of Thomas and Fischer [22], Schek and Scholl [20], and Colby [4]. NRC(=) enjoys certain advantages over these languages: it is naturally embedded in functional languages, it is readily extensible, and it has a compact equational theory. Therefore, it is used in this report as a basis for investigating aggregate functions.


Rational Number Linear Order Base Type Query Language Expressive Power 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    V. Breazu-Tannen, P. Buneman, and S. Naqvi. Structural recursion as a query language. In Proceedings of 3rd International Workshop on Database Programming Languages, Naphlion, Greece, pages 9–19. Morgan Kaufmann, August 1991.Google Scholar
  2. [2]
    V. Breazu-Tannen and R. Subrahmanyam. Logical and computational aspects of programming with Sets/Bags/Lists. In LNCS 510: Proceedings of 18th International Colloquium on Automata, Languages, and Programming, Madrid, Spain, July 1991, pages 60–75. Springer Verlag, 1991.CrossRefGoogle Scholar
  3. [3]
    Val Breazu-Tannen, Peter Buneman, and Limsoon Wong. Naturally embedded query languages. In LNCS 646: Proceedings of International Conference on Database Theory, Berlin, Germany, October, 1992, pages 140–154. Springer-Verlag, October 1992.Google Scholar
  4. [4]
    Latha S. Colby. A recursive algebra for nested relations. Information Systems, 15 (5): 567–582, 1990.CrossRefGoogle Scholar
  5. [5]
    Jan Van den Bussche. Complex object manipulation through identifiers: An algebraic perspective. technical Report 92–41, University of Antwerp, Department of Mathematics and Computer Science, Universiteitsplein 1, B-2610 Antwerp, Belgium, September 1992.Google Scholar
  6. [6]
    Stephane Grumbach and Victor Vianu. Playing games with objects. In LNCS 470: 3rd International Conference on Database Theory, Paris, France, December 1990, pages 25–39. Springer-Verlag, 1990.Google Scholar
  7. [7]
    Richard Hull and Jianwen Su. On the expressive power of database queries with intermediate types. Journal of Computer and System Sciences, 43: 219–267, 1991.MathSciNetMATHCrossRefGoogle Scholar
  8. [8]
    Neil Immerman. Relational queries computable in polynomial time. Information and Control, 68: 86–104, 1986.MathSciNetMATHCrossRefGoogle Scholar
  9. [9]
    G. Jaeschke and H. J. Schek. Remarks on the algebra of nonfirst normal form relations. In Proceedings ACM Symposium on Principles of Database Systems, pages 124–138, Los Angeles, California, March 1982.CrossRefGoogle Scholar
  10. [10]
    L. A. Jategaonkar and J. C. Mitchell. ML with extended pattern matching and subtypes. In Proceedings of ACM Conference on LISP and Functional Programming, pages 198–211, Snowbird, Utah, July 1988.Google Scholar
  11. [11]
    Aviel Klausner and Nathan Goodman. Multirelations: Semantics and languages. In Proceedings of 11th International Conference on Very Large Databases, Stockholm, August 1985, pages 251–258, Los Altos, CA, August 1985. Morgan Kaufmann.Google Scholar
  12. [12]
    Anthony Klug. Equivalence of relational algebra and relational calculus query languages having aggregate functions. Journal of the ACM, 29 (3): 699–717, July 1982.MathSciNetMATHCrossRefGoogle Scholar
  13. [13]
    J. B. Kruskal. The theory of well-quasi-ordering: A frequently discovered concept. Journal of Combinatorial Theory Series A, 13: 297–305, 1972.MathSciNetMATHCrossRefGoogle Scholar
  14. [14]
    K. Kupert, G. Saake, and L. Wegner. Duplicate detection and deletion in the extended NF2 data model. In LNCS 367: Foundation of Data Organization and Algorithms, pages 83–101. Springer-Verlag, June 1989.CrossRefGoogle Scholar
  15. [15]
    Leonid Libkin and Limsoon Wong. Query languages for bags. This volume.Google Scholar
  16. [16]
    Eugenio Moggi. Notions of computation and monads. Information and Computation, 93: 55–92, 1991.MathSciNetMATHCrossRefGoogle Scholar
  17. [17]
    A. Ohori, P. Buneman, and V. Breazu-Tannen. Database programming in Machiavelli: A polymorphic language with static type inference. In Proceedings of ACM International Conference on Management of Data, pages 46–57, Portland, Oregon, June 1989.Google Scholar
  18. [18]
    G. Ozsoyoglu, Z. M. Ozsoyoglu, and V. Matos. Extending relational algebra and relational calculus with set-valued attributes and aggregate functions. ACM Transactions on Database Systems, 12 (4): 566–592, December 1987.MathSciNetCrossRefGoogle Scholar
  19. [19]
    Jan Paredaens and Dirk Van Gucht. Converting nested relational algebra expressions into flat algebra expressions. ACM Transaction on Database Systems, 17 (1): 65–93, March 1992.CrossRefGoogle Scholar
  20. [20]
    H.-J. Schek and M. H. Scholl. The relational model with relation-valued attributes. Information Systems, 11 (2): 137–147, 1986.MATHCrossRefGoogle Scholar
  21. [21]
    Dan Suciu. Fixpoints and bounded fixpoints for complex objects. This volume.Google Scholar
  22. [22]
    S. J. Thomas and P. C. Fischer. Nested relational structures. In Advances in Computing Research: Theory of Databases, pages 269–307. JAI Press, 1986Google Scholar
  23. [23]
    M. Y. Vardi. The complexity of relational query languages. In Proceedings of 14th ACM Symposium on Theory of Computing, pages 137–146, 1982.Google Scholar
  24. [24]
    Philip Wadler. Comprehending monads. In Proceedings of ACM Conference on Lisp and Functional Programming, Nice, June 1990.Google Scholar
  25. [25]
    W. Wechler. Universal Algebra for Computer Scientists, volume 25 of EATCS Monograph on Theoretical Computer Science. Springer-Verlag, Berlin, 1992.CrossRefGoogle Scholar
  26. [26]
    Limsoon Wong. Normal forms and conservative properties for query languages over collection types. In Proceedings of 12th ACM Symposium on Principles of Database Systems, pages 26–36, Washington, D. C., May 1993.Google Scholar
  27. [27]
    Limsoon Wong. Query languages over collection types. Manuscript available from Limsoon@Saul.CIS.UPenn.EDU, June 1993.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  • Leonid Libkin
    • 1
  • Limsoon Wong
    • 1
  1. 1.Department of Computer and Information ScienceUniversity of PennsylvaniaPhiladelphiaUSA

Personalised recommendations