Conditionals - sql, PL-SQL Programming

Conditionals - SQL

At first sight SQL does not appear to have a single operator for expressing logical implication. In this respect it would be in common with most programming languages, including Tutorial D. However, standard SQL defines a partial ordering for its three truth values, under which false is deemed to precede true. Thus, the comparisons p < q, p > q, p <= q, and p >= q are all supported in standard SQL (in addition to p = q, of course).

it is noted that in 2VL p → q is equivalent to ¬ p ∨ q. Study of Figure 3.5 reveals that ¬ p ∨ q does indeed equate to p → q when neither operand is unknown, and the same is true of p <= q! (It is the pronunciation, "is less than or equal to", rather than "implies", that led to my observation that SQL appears to include direct support for a 3VL form of implication by accident.)

1570_Conditionals - SQL.png

Figure: The SQL Truth Tables for ¬ p∨ q and p <= q

Note, however, that p <= q is not equivalent to ¬ p ∨ q. Intuitively, we understand that "p implies q" is true whenever q is true. This holds for ¬ p ∨ q but not for p <= q, as the row for p = U and q = T shows. The U in the last column for that row arises from SQL's general rule that whenever an operand of a comparison is NULL, the result is unknown-and NULL, when it is the result of evaluating a Boolean expression, is considered synonymous with unknown. In fact, Figure gives a demonstration of the fact that SQL is not always faithful to its own concept, that NULL represents "a value exists here but we don't know which value". What U really means when it appears in the column for p <= q is that <= is undefined for that particular pair of truth values.

Posted Date: 1/18/2013 4:16:23 AM | Location : United States







Related Discussions:- Conditionals - sql, Assignment Help, Ask Question on Conditionals - sql, Get Answer, Expert's Help, Conditionals - sql Discussions

Write discussion on Conditionals - sql
Your posts are moderated
Related Questions
Task 2 [12 marks] Write the package body for the following package specification (the detailed description of each function and procedure is provided in the appendix below). Place

Methods: In normal, a method is a subprogram declared in an object type specification using the keyword MEMBER or STATIC. The method cannot have similar name as the object typ

Parameter and Keyword Description: record_type_name: This identifies the user-defined type specifier that is used in the subsequent declarations of the records. NOT N

EXCEPTION_INIT Pragma The pragma EXCEPTION_INIT relates an exception name with an Oracle error number. Which allow you to refer to any internal exception by the name and to wri

Use of Table Comparisons - SQL Table comparisons where it is noted that although table expressions cannot be compared, we have TABLE (t) to convert a table expression t into

Functions   The function is a subprogram that calculates a value. The Functions and procedures are structured similar, except that the functions have a RETURN clause. You can

Name Resolution In potentially uncertain SQL statements, the names of the database columns take precedence over the names of the local variables and formal parameters. For e.g.

Other monadic - SQL In 2VL there are just 4 (2 2 ) monadic operators, of which negation is really the only "useful" one. When a third truth value is introduced we have 27 (3 3

Using Pragma RESTRICT_REFERENCES: The function called from the SQL statements should obey certain rules meant to control the side effects. To check for violation of the rules,

BEGIN Parameter Description in pl sql: BEGIN: This keyword signals the beginning of the executable section of a PL/SQL block, that contains executable statements. The execut