O'Reilly logo

SQL and Relational Theory, 2nd Edition by C.J. Date

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

MORE ON PREDICATES

In this section,[192] I show how it’s possible to get “don’t know” answers out of a database without nulls, even if there aren’t any tables like table SUC (suppliers with an unknown city) that explicitly represent the fact that something is unknown. For simplicity, suppose our database consists in its entirety of just table SC (suppliers with a known city), as shown in Figure C-9 below.

Table SC (suppliers with a known city)

Figure C-9. Table SC (suppliers with a known city)

Now consider the following query on table SC:

Is supplier S1 in London?

In Tutorial D:[193]

( SC WHERE SNO = 'S1' AND CITY = 'London' ) { }

Clearly, this expression evaluates to either TABLE_DEE or TABLE_DUM: TABLE_DEE if supplier S1 is in London, TABLE_DUM otherwise. Note, therefore, that—as I mentioned in Chapter 3—TABLE_DEE and TABLE_DUM can be interpreted as yes and no, respectively. Note too the implicit appeal to The Closed World Assumption!—in effect, we’re saying that if the row (S1,London) fails to appear in table SC, we’re allowed to conclude that it’s not the case that supplier S1 is in London.

Now, I said previously that the predicate for table SC was Supplier SNO is located in city CITY. But it isn’t—not really. To see why not, consider what happens if some user tries to introduce a new row into the table, perhaps as follows:

INSERT SC RELATION { TUPLE { SNO 'S6' , CITY 'Madrid' } } ;

In effect, the user here is telling the system ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required