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
Relational Operators The relational operators permit you to compare randomly complex expressions. The list below provides the meaning of each operator:

Problem: (a) Define the following terms: (i) data mining. (ii) OLAP. (b) Differentiate between snowflake schema and star schema. Support your answer with appropriate

Wrapping and unwrapping in SQL Operators WRAP and UNWRAP in connection with attributes whose declared types are tuple types. Example shows how extension and projection can be

Example of DELETE - SQL As with UPDATE, a FOR PORTION OF clause can be specified if the target table has a defined period name, as illustrated in Example. Example: Deleting

Initializing Records The illustration below shows that you can initialize a record in its type definition. Whenever you declare a record of the type TimeRec, its 3 fields supp

Procedural Constraint Enforcement (Triggers) SQL has an alternative method of addressing database integrity, involving event-driven procedural code. The special procedures th

Benefit of the dynamic SQL: This part shows you how to take full benefit of the dynamic SQL and how to keep away from some of the common pitfalls. Passing the Names of Sc

Advantages of Wrapping   The PL/SQL Wrapper convert the PL/SQL source code into a transitional form of the object code. By hiding the application internals, the Wrapper secure

Identifiers You use identifiers to name the PL/SQL program items and units that include constants, variables, cursors, exceptions, cursor variables, subprograms, and packages.