Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

SQL’s Three-Valued Logic and Certain Answers

Published: 18 March 2016 Publication History

Abstract

The goal of the article is to bridge the difference between theoretical and practical approaches to answering queries over databases with nulls. Theoretical research has long ago identified the notion of correctness of query answering over incomplete data: one needs to find certain answers, which are true regardless of how incomplete information is interpreted. This serves as the notion of correctness of query answering, but carries a huge complexity tag. In practice, on the other hand, query answering must be very efficient, and to achieve this, SQL uses three-valued logic for evaluating queries on databases with nulls. Due to the complexity mismatch, the two approaches cannot coincide, but perhaps they are related in some way. For instance, does SQL always produce answers we can be certain about?
This is not so: SQL’s and certain answers semantics could be totally unrelated. We show, however, that a slight modification of the three-valued semantics for relational calculus queries can provide the required certainty guarantees. The key point of the new scheme is to fully utilize the three-valued semantics, and classify answers not into certain or noncertain, as was done before, but rather into certainly true, certainly false, or unknown. This yields relatively small changes to the evaluation procedure, which we consider at the level of both declarative (relational calculus) and procedural (relational algebra) queries. These new evaluation procedures give us certainty guarantees even for queries returning tuples with null values.

References

[1]
Serge Abiteboul and Oliver Duschka. 1998. Complexity of answering queries using materialized views. In Proceedings of the ACM Symposium on Principles of Database Systems (PODS). 254--263.
[2]
Serge Abiteboul, Richard Hull, and Victor Vianu. 1995. Foundations of Databases. Addison-Wesley.
[3]
Serge Abiteboul, P. Kanellakis, and G. Grahne. 1991. On the representation and querying of sets of possible worlds. Theoretical Computer Science 78, 1 (1991), 158--187.
[4]
Marcelo Arenas, Pablo Barceló, Leonid Libkin, and Filip Murlak. 2014. Foundations of Data Exchange. Cambridge University Press.
[5]
Andrea Calì, Georg Gottlob, and Thomas Lukasiewicz. 2012. A general datalog-based framework for tractable query answering over ontologies. Journal of Web Semantics 14 (2012), 57--83.
[6]
Diego Calvanese, Giuseppe De Giacomo, Domenico Lembo, Maurizio Lenzerini, and Riccardo Rosati. 2007. Tractable reasoning and efficient query answering in description logics: The DL-Lite family. Journal of Automated Reasoning 39, 3 (2007), 385--429.
[7]
Kevin Compton. 1983. Some useful preservation theorems. Journal of Symbolic Logic 48, 2 (1983), 427--440.
[8]
Hugh Darwen and Chris J. Date. 1995. The third manifesto. SIGMOD Record 24, 1 (1995), 39--49.
[9]
Chris J. Date. 2005. Database in Depth: Relational Theory for Practitioners. O’Reilly. I--XVIII, 1--208.
[10]
Chris J. Date and Hugh Darwen. 1996. A Guide to the SQL Standard. Addison-Wesley.
[11]
G. H. Gessert. 1990. Four valued logic for relational database systems. SIGMOD Record 19, 1 (1990), 29--35.
[12]
Amélie Gheerbrant, Leonid Libkin, and Cristina Sirangelo. 2014. Naïve evaluation of queries over incomplete databases. ACM Transactions on Database Systems 39, 4 (2014), 31:1--31:42.
[13]
Amélie Gheerbrant, Leonid Libkin, and Tony Tan. 2012. On the complexity of query answering over incomplete XML documents. In Proceedings of the International Conference on Database Theory (ICDT). 169--181.
[14]
Laura M. Haas, Mauricio A. Hernández, Howard Ho, Lucian Popa, and Mary Roth. 2005. Clio grows up: From research prototype to industrial tool. In SIGMOD. 805--810.
[15]
Tomasz Imielinski and Witold Lipski. 1984. Incomplete information in relational databases. Journal of the ACM 31, 4 (1984), 761--791.
[16]
Hans-Joachim Klein. 1994. How to modify SQL queries in order to guarantee sure answers. SIGMOD Record 23, 3 (1994), 14--20.
[17]
Hans-Joachim Klein. 1999. On the use of marked nulls for the evaluation of queries against incomplete relational databases. In Fundamentals of Information Systems, Torsten Polle, Torsten Ripke, and Klaus-Dieter Schewe (Eds.). Kluwer, 81--98.
[18]
Maurizio Lenzerini. 2002. Data integration: A theoretical perspective. In Proceedings of the ACM Symposium on Principles of Database Systems (PODS). 233--246.
[19]
Leonid Libkin. 2014a. Certain answers as objects and knowledge. In Principles of Knowledge Representation and Reasoning (KR). 328--337.
[20]
Leonid Libkin. 2014b. Incomplete information: What went wrong and how to fix it. In Proceedings of the ACM Symposium on Principles of Database Systems (PODS). 1--13.
[21]
W. Lipski. 1979. On semantic issues connected with incomplete information databases. ACM Transactions on Database Systems 4, 3 (1979), 262--296.
[22]
Witold Lipski. 1984. On relational algebra with marked nulls. In Proceedings of the ACM Symposium on Principles of Database Systems (PODS). 201--203.
[23]
Bruno Marnette, Giansalvatore Mecca, Paolo Papotti, Salvatore Raunich, and Donatello Santoro. 2011. ++Spicy: An opensource tool for second-generation schema mapping and data exchange. PVLDB 4, 12 (2011), 1438--1441.
[24]
Mike Paterson and Mark N. Wegman. 1978. Linear unification. Journal of Computer and System Sciences 16, 2 (1978), 158--167.
[25]
R. Reiter. 1977. On closed world data bases. In Logic and Data Bases. 55--76.
[26]
R. Reiter. 1986. A sound and sometimes complete query evaluation algorithm for relational databases with null values. Journal of the ACM 33, 2 (1986), 349--347.
[27]
Kwok-bun Yue. 1991. A more general model for handling missing information in relational databases using a 3-valued logic. SIGMOD Record 20, 3 (1991), 43--49.

Cited By

View all
  • (2024)Postulates for Provenance: Instance-based provenance for first-order logicProceedings of the ACM on Management of Data10.1145/36515962:2(1-16)Online publication date: 14-May-2024
  • (2024)Handling Null Values in SQL Queries on Relational Databases2024 10th International Conference on Engineering, Applied Sciences, and Technology (ICEAST)10.1109/ICEAST61342.2024.10553913(65-68)Online publication date: 1-May-2024
  • (2024)Towards declarative comparabilities: Application to functional dependenciesJournal of Computer and System Sciences10.1016/j.jcss.2024.103576146(103576)Online publication date: Dec-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Database Systems
ACM Transactions on Database Systems  Volume 41, Issue 1
Invited Paper from ICDT 2015, SIGMOD 2014, EDBT 2014 and Regular Papers
April 2016
287 pages
ISSN:0362-5915
EISSN:1557-4644
DOI:10.1145/2897141
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 March 2016
Accepted: 01 October 2015
Revised: 01 September 2015
Received: 01 April 2015
Published in TODS Volume 41, Issue 1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Null values
  2. certain answers
  3. incomplete information
  4. query evaluation
  5. three-valued logic

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • EPSRC

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)35
  • Downloads (Last 6 weeks)5
Reflects downloads up to 30 Aug 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Postulates for Provenance: Instance-based provenance for first-order logicProceedings of the ACM on Management of Data10.1145/36515962:2(1-16)Online publication date: 14-May-2024
  • (2024)Handling Null Values in SQL Queries on Relational Databases2024 10th International Conference on Engineering, Applied Sciences, and Technology (ICEAST)10.1109/ICEAST61342.2024.10553913(65-68)Online publication date: 1-May-2024
  • (2024)Towards declarative comparabilities: Application to functional dependenciesJournal of Computer and System Sciences10.1016/j.jcss.2024.103576146(103576)Online publication date: Dec-2024
  • (2023)Preferences and constraints in abstract argumentationProceedings of the Thirty-Second International Joint Conference on Artificial Intelligence10.24963/ijcai.2023/345(3095-3103)Online publication date: 19-Aug-2023
  • (2023)SQL Nulls and Two-Valued LogicProceedings of the 42nd ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems10.1145/3584372.3588661(11-20)Online publication date: 18-Jun-2023
  • (2023)Querying Data Exchange Settings Beyond Positive QueriesTheory and Practice of Logic Programming10.1017/S1471068423000339(1-29)Online publication date: 15-Aug-2023
  • (2023)A Neutrosophic Cognitive Maps Approach for Pestle Analysis in Food IndustryEmerging Trends in Expert Applications and Security10.1007/978-981-99-1909-3_30(349-360)Online publication date: 13-Jun-2023
  • (2023)Relational Expressions for Data Transformation and ComputationDatabases Theory and Applications10.1007/978-3-031-47843-7_17(241-255)Online publication date: 1-Nov-2023
  • (2022)DEGAIN: Generative-Adversarial-Network-Based Missing Data ImputationInformation10.3390/info1312057513:12(575)Online publication date: 12-Dec-2022
  • (2022)Troubles with nulls, views from the usersProceedings of the VLDB Endowment10.14778/3551793.355181815:11(2613-2625)Online publication date: 1-Jul-2022
  • Show More Cited By

View Options

Get Access

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media