On the Logic of SQL Nulls
نویسندگان
چکیده
The logic of nulls in databases has been subject of investigation since their introduction in Codd’s Relational Model, which is the foundation of the SQL standard. In the logic based approaches to modelling relational databases proposed so far, nulls are considered as representing unknown values. Such existential semantics fails to capture the behaviour of the SQL standard. We show that, according to Codd’s Relational Model, a SQL null value represents a non-existing value; as a consequence no indeterminacy is introduced by SQL null values. In this paper we introduce an extension of first-order logic accounting for predicates with missing arguments. We show that the domain independent fragment of this logic is equivalent to Codd’s relational algebra with SQL nulls. Moreover, we prove a faithful encoding of the logic into standard first-order logic, so that we can employ classical deduction machinery. 1 Relational Databases and SQL Null Values Consider a database instance with null values over the relational schema {R/2}, and a SQL query asking for the tuples in R being equal to themselves: R : 1 2 a b b N SELECT * FROM R WHERE R.1 = R.1 AND R.2 = R.2 ; ⇒ 1 | 2 ---+--a | b (1 row)
منابع مشابه
The Algebra and the Logic for SQL Nulls
The logic of nulls in databases has been subject of investigation since their introduction in Codd’s Relational Model, which is the foundation of the SQL standard. In the logic based approaches to modelling relational databases proposed so far, nulls are considered as representing unknown values. Such existential semantics fails to capture the behaviour of the SQL standard. We show that, accord...
متن کاملA Formal Semantics of SQL Queries, Its Validation, and Applications
While formal semantics of theoretical languages underlying SQL have been provided in the past, they all made simplifying assumptions ranging from changes in the syntax to omitting bag semantics and nulls. This situation is reminiscent of what happens in the field of programming languages, where semantics of formal calculi underlying the main features of languages are abundant, but formal semant...
متن کاملOn the Codd Semantics of SQL Nulls
Theoretical models used in database research often have subtle differences with those occurring in practice. One particular mismatch that is usually neglected concerns the use of marked nulls to represent missing values in theoretical models of incompleteness, while in an SQL database these are all denoted by the same syntactic NULL object. It is commonly argued that results obtained in the mod...
متن کاملA SQL’s Three-Valued Logic and Certain Answers
The goal of the paper 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 correc...
متن کاملBringing BLINK Closer to the Full Power of SQL
BLINK is a prototype of an in-memory based query processor that exploits heavily the underlying CPU infrastructure. It is very sensitive to the processor’s caches and instruction set. In this paper, we describe how to close two major functional gaps in BLINK, which arise from real-world workloads. The manipulation of the data maintained by BLINK require specialized data structures. Another aspe...
متن کامل