skip to main content
10.1145/1265530.1265551acmconferencesArticle/Chapter ViewAbstractPublication PagesmodConference Proceedingsconference-collections
Article

A crash course on database queries

Published:11 June 2007Publication History

ABSTRACT

Complex database queries, like programs in general, can "crash", i.e., can raise runtime errors. We want to avoid crashes without losing expressive power, or we want to correctly predict the absence of crashes. We show how concepts and techniques from programming language theory, notably type systems and reflection, can be adaptedto this end. Of course, the specific nature of database queries (asopposed to general programs), also requires some new methods, andraises new questions.

References

  1. S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison-Wesley, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Serge Abiteboul, Rakesh Agrawal, Phil Bernstein, Mike Carey, Stefano Ceri, Bruce Croft, David DeWitt, Mike Franklin, Hector Garcia Molina, Dieter Gawlick, Jim Gray, Laura Haas, Alon Halevy, Joe Hellerstein, Yannis Ioannidis, Martin Kersten, Michael Pazzani, Mike Lesk, David Maier, Jeff Naughton, Hans Schek, Timos Sellis, Avi Silberschatz, Mike Stonebraker, Rick Snodgrass, Jeff Ullman, Gerhard Weikum, Jennifer Widom, and Stan Zdonik. The Lowell database research self-assessment. Commun. ACM, 48(5):111--118, 2005 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Noga Alon, Tova Milo, Frank Neven, Dan Suciu, and Victor Vianu. Typechecking XML views of relational databases. ACM Transactions on Computational Logic, 4(3):315--354, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Noga Alon, Tova Milo, Frank Neven, Dan Suciu, and Victor Vianu. XML with data values: typechecking revisited. Journal of Computer and System Sciences, 66(4):688--727, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Henk P. Barendregt. The Lambda Calculus: its Syntax and Semantics. North-Holland, 1984.Google ScholarGoogle Scholar
  6. Scott Boag, Don Chamberlin, Mary F. Fernández, Daniela Florescu, Jonathan Robie, and Jérôme Siméon. XQuery 1.0: An XML Query Language. W3C Working Draft, February 2005.Google ScholarGoogle Scholar
  7. Don Box and Anders Hejlsberg. The LINQ Project: .NET Language Integrated Query. http://msdn.microsoft.com/netframework/future/linq/, March 2006.Google ScholarGoogle Scholar
  8. Peter Buneman, Susan B. Davidson, Mary F. Fernandez, and Dan Suciu. Adding structure to unstructured data. In Foto N. Afrati and Phokion Kolaitis, editors, Database Theory--ICDT'97, 6th International Conference, volume 1186, pages 336--350, Delphi, Greece, 1997. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Peter Buneman, Shamim A. Naqvi, Val Tannen, and Limsoon Wong. Principles of programming with complex objects and collection types. Theoretical Computer Science, 149(1):3--48, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Peter Buneman and Atsushi Ohori. Polymorphism and type inference in database programming. ACM Transactions on Database Systems, 21(1):30--76, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Calcagno, E. Moggi, and T. Sheard. Closed types for a safe imperative MetaML. Journal of Functional Programming, 13(3):545--571, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Luca Cardelli. Type systems. In The Computer Science and Engineering Handbook, pages 2208--2236. CRC Press, 1997.Google ScholarGoogle Scholar
  13. R. G. G. Cattell, Douglas K. Barry, Mark Berler, Jeff Eastman, David Jordan, Craig Russell, Olaf Schadow, Torsten Stanienda, and Fernando Velez, editors. The Object Data Standard: ODMG 3.0. Morgan Kaufmann, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. W. Chen, M. Kifer, and D. S. Warren. HiLog: A foundation for higher-order logic programming. Journal of Logic Programming, 15(3):187--230, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Luis Damas and Robin Milner. Principal type-schemes for functional programs. In POPL '82: Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 207--212, New York, NY, USA, 1982. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Denise Draper, Peter Fankhauser, Mary F. Fernández, Ashok Malhotra, Kristoffer Rose, Michael Rys, Jérôme Siméon, and Philip Wadler. XQuery 1.0 and XPath 2.0 Formal Semantics. W3C Working Draft, February 2005.Google ScholarGoogle Scholar
  17. Mary F. Fernández, Ashok Malhotra, Jonathan Marsh, Marton Nagy, and Norman Walsh. XQuery 1.0 and XPath 2.0 Data Model. W3C Working Draft, February 2005.Google ScholarGoogle Scholar
  18. Alain Frisch, Giuseppe Castagna, and Véronique Benzaken. CDuce: an XML-centric general-purpose language. In Proceedings of the eighth ACM SIGPLAN International Conference on Functional Programming, pages 51--63. ACM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Gawlick, D. Lenkov, A. Yalamanchi, et al. Applications for expression data in relational database systems. In Proceedings 20th International Conference on Data Engineering, pages 609--620. IEEE Computer Society, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Roy Goldman and Jennifer Widom. Dataguides: Enabling query formulation and optimization in semistructured databases. In VLDB'97 Proceedings of 23rd International Conference on Very Large Data Bases, pages 436--445, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. M. Gyssens and L. V. S. Lakshmanan. A foundation for multi-dimensional databases. In Proceedings 23rd International Conference on Very Large Data Bases, pages 106--115. Morgan Kaufmann, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Roger Hindley. The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society, 146:29--60, December 1969.Google ScholarGoogle Scholar
  23. Haruo Hosoya and Benjamin C. Pierce. XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology (TOIT), 3(2):117--148, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Haruo Hosoya, Jérôme Vouillon, and Benjamin C. Pierce. Regular expression types for XML. ACM Transactions on Programming Languages and Systems, 27(1):46--90, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. M. Jain, A. Mendhekar, and D. Van Gucht. A uniform data model for relational data and meta-data query processing. In Advances in Data Management '95, pages 146--165. Tata McGraw-Hill, 1995.Google ScholarGoogle Scholar
  26. Christoph Koch. On the complexity of nonrecursive xquery and functional query languages on complex values. ACM Trans. Database Syst., 31(4):1215--1256, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. L. V. S. Lakshmanan, F. Sadri, and S. N. Subramanian. SchemaSQL: An extension to SQL for multidatabase interoperability. ACM Transactions on Database Systems, 26(4):476--519, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Zi Lin, Bingsheng He, and Byron Choi. A quantitative summary of XML structures. In ER 2006 - 25th International Conference on Conceptual Modeling, volume 4215 of Lecture Notes in Computer Science, pages 228--240. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Sebastian Maneth, Alexandru Berlea, Thomas Perst, and Helmut Seidl. XML type checking with macro tree transducers. In Chen Li, editor, PODS, pages 283--294. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Sebastian Maneth, Thomas Perst, and Helmut Seidl. Exact XML type checking in polynomial time. In Schwentick and Suciu {41}, pages 254--268.Google ScholarGoogle Scholar
  31. Wim Martens and Frank Neven. Frontiers of tractability for typechecking simple XML transformations. In Proceedings of the Twenty-third ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pages 23--34. ACM Press, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Wim Martens and Frank Neven. On the complexity of typechecking top-down XML transformations. Theor. Comput. Sci., 336(1):153--180, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Jim Melton. Understanding SQL's Stored Procedures. Morgan Kaufmann, San Mateo, CA, USA, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Robin Milner. A theory of type polymorphism in programming. J. Comput. Syst. Sci., 17(3):348--375, 1978.Google ScholarGoogle Scholar
  35. Tova Milo, Dan Suciu, and Victor Vianu. Typechecking for XML transformers. In Proceedings of the Nineteenth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pages 11--22. ACM Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. F. Neven, J. Van den Bussche, D. Van Gucht, and G. Vossen. Typed query languages for databases containing queries. Information Systems, 24(7):569--595, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Atsushi Ohori. A polymorphic record calculus and its compilation. ACM Transactions on Programming Languages and Systems, 17(6):844--895, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Benjamin C. Pierce. Types and Programming Languages. MIT Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Didier Rémy. Type inference for records in a natural extension of ML. In Carl A. Gunter and John C. Mitchell, editors, Theoretical Aspects Of Object-Oriented Programming. Types, Semantics and Language Design. MIT Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. K. Ross. Relations with relation names as arguments: Algebra and calculus. In Proceedings 11th ACM Symposium on Principles of Database Systems, pages 346--353, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Thomas Schwentick and Dan Suciu, editors. Database Theory - ICDT 2007, 11th International Conference, Barcelona, Spain, January 10--12, 2007, Proceedings, volume 4353 of Lecture Notes in Computer Science. Springer, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. H. Schwichtenberg. Definierbare funktionen in λ-kalkül mit typen. Archiv für mathematische Logik und Grundlagenforschung, 174:113--114, 1976.Google ScholarGoogle Scholar
  43. M. Stonebraker et al. QUEL as a data type. In B. Yormark, editor, Proceedings of SIGMOD 84 Annual Meeting, volume 14:2 of SIGMOD Record, pages 208--214. ACM Press, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. M. Stonebraker et al. Extending a database system with procedures. ACM Transactions on Database Systems, 12(3):350--376, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Dan Suciu. Typechecking for semistructured data. In Database Programming Languages, 8th International Workshop, DBPL 2001, Revised Papers, volume 2397 of Lecture Notes in Computer Science, pages 1--20. Springer-Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Martin Sulzmann. A General Framework for Hindley/Milner Type Systems with Constraints. PhD thesis, Yale University, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Martin Sulzmann. A general type inference framework for Hindley/Milner style systems. In Functional and Logic Programming: FLOPS 2001, volume 2024 of Lecture Notes in Computer Science, pages 248--263. Springer-Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Wolfgang Thomas. Languages, Automata, and Logic, volume 3 of Handbook of Formal Languages, chapter 7, pages 389--456. Springer, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Henry S. Thompson, David Beech, Murray Maloney, and Noah Mendelsohn. XML Schema Part 1: Structures. W3C Recommendation, May 2001.Google ScholarGoogle Scholar
  51. J. Van den Bussche, D. Van Gucht, and G. Vossen. Reflective programming in the relational algebra. Journal of Computer and System Sciences, 52(3):537--549, June 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. J. Van den Bussche, S. Vansummeren, and G. Vossen. Meta-SQL: Towards practical meta-querying. In Advances in Database Technology--EDBT 2004, volume 2992 of Lecture Notes in Computer Science, pages 823--825. Springer, 2004.Google ScholarGoogle Scholar
  53. J. Van den Bussche, S. Vansummeren, and G. Vossen. Towards practical meta-querying. Information Systems, 30(4):317--332, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. J. Van den Bussche and E. Waller. Polymorphic type inference for the relational algebra. Journal of Computer and System Sciences, 64:694--718, 2002.Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Jan Van den Bussche, Dirk Van Gucht, and Stijn Vansummeren. Well-definedness and semantic type checking for the nested relational calculus. Theoretical Computer Science, 371(3):183--199, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Jan Van den Bussche and Stijn Vansummeren. Polymorphic type inference for the named nested relational calculus. ACM Transactions on Computational Logic, To appear.Google ScholarGoogle Scholar
  57. Stijn Vansummeren. Deciding well-definedness of XQuery fragments. In Proceedings of the twenty-fourth ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, pages 37--48, New York, NY, USA, 2005. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Stijn Vansummeren. On deciding well-definedness for query languages on trees. Technical report, Hasselt University, 2005.Google ScholarGoogle Scholar
  59. Stijn Vansummeren. On the complexity of deciding typability in the relational algebra. Acta Informatica, 41(6):367--381, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. M. Vardi. The complexity of relational query languages. In Proceedings 14th ACM Symposium on the Theory of Computing, pages 137--146, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Mitchell Wand. Type inference for record concatenation and multiple inheritance. Information and Computation, 93(1):1--15, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Piotr Wieczorek. Complexity of typechecking XML views of relational databases. In Schwentick and Suciu {41}, pages 239--253.Google ScholarGoogle Scholar
  63. Limsoon Wong. Kleisli, a functional query system. Journal of Functional Programming, 10(1):19--56, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. C.M. Wyss and E.L. Robertson. Relational languages for metadata integration. ACM Transactions on Database Systems, 30(2):624--660, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. XML syntax for XQuery 1.0 (XQueryX). W3C Working Draft 19 December 2003.Google ScholarGoogle Scholar

Index Terms

  1. A crash course on database queries

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!