Conditionals - sql, PL-SQL Programming

Assignment Help:

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.


Related Discussions:- Conditionals - sql

Name resolution - pl/sql, Name Resolution   During the compilation, th...

Name Resolution   During the compilation, the PL/SQL compiler relates identifiers like the name of a variable with an address or memory location, actual value, or datatype. Th

Sql queries-oracle , 1- You can check attribute names from each table in D...

1- You can check attribute names from each table in DBF11 by running for example:  desc dbf11.Member;  desc dbf11.Agent;  desc dbf11.Producer; Because some attribute names in

How exceptions propagate in pl/sql programming?, How Exceptions Propagate ?...

How Exceptions Propagate ? Whenever an exception is raised, and if the PL/SQL cannot find a handler for it in the present subprogram or block, the exception propagates. That is

Query optimization, 1.( /5 marks) Suppose that a B+-tree index with the sea...

1.( /5 marks) Suppose that a B+-tree index with the search key (dept_name, building) is available on relation department. What would be the best way to handle the following selecti

Opening a cursor variable, Opening a Cursor Variable The OPEN-FOR stat...

Opening a Cursor Variable The OPEN-FOR statement relates a cursor variable with the multi-row query, executes the query, and then identifies the result set. The syntax for ope

Subprograms, Subprograms The PL/SQL has two types of subprograms known ...

Subprograms The PL/SQL has two types of subprograms known as the procedures and functions that can take parameters and be invoked. As the following example represents, a subp

Multiset types - sql, Multiset types - SQL An SQL multiset is what in ...

Multiset types - SQL An SQL multiset is what in mathematics is also known as a bag-something like a set except that the same element can appear more than once. The body of an

Example of delete - sql, Example of DELETE - SQL As with UPDATE, a FOR...

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

Design a script and integrate procedures, Initial thought process: Design...

Initial thought process: Design a script which was simple and user friendly. Integrate procedures/functions to extract data under the hood. I focused on giving the user the opt

Implement a new discount for return shoppers, Brewbean's is implementing a ...

Brewbean's is implementing a new discount for return shoppers - every fifth completed order receives a 10% discount. The count of orders for a shopper is placed in a packaged varia

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd