Example of not exists operator - sql, PL-SQL Programming

Example of NOT EXISTS Operator - SQL

Example is a translation into SQL of the corresponding example, which is included there merely to show that for any scalar comparison there is an alternative formulation using IS_EMPTY.

Example: MAX_ENROLMENTS expressed using an invocation of NOT EXISTS





V (N)

WHERE V.N > 20000));


  • VALUES ( SELECT COUNT(*) FROM IS_ENROLLED_ON ) denotes a table with just one column, unnamed, in whose single row the value of that column is the number of rows in the current value of IS_ENROLLED_ON. The SELECT expression is parenthesized to make it into a scalar subquery and given as the argument to an invocation of VALUES, which makes the number denoted by that scalar subquery into a one-row, one-column table. (Actually, it might be safer to place an extra pair of parentheses around the SELECT expression here. Although VALUES 1 and VALUES (1) are equivalent, it might not be clear as to which role the single parentheses are taking: do they denote a scalar subquery, as I have assumed, or are they the optional ones surrounding a single table expression? If the latter, we would expect a syntax error.)
  • AS V (N) defines the range variable V to refer to what in this case is just the single row of that table, and also assigns the name N to its only column.
  •  WHERE V.N > 20000 operates on that one-row, one-column table to yield a table of heading (N INTEGER) that is empty if and only if the single row in that one-row, one-column table fails to satisfy the condition N > 20000. Thus, the result is empty only when the number of enrolments is in fact no greater than the maximum allowed.
Posted Date: 1/18/2013 7:44:45 AM | Location : United States

Related Discussions:- Example of not exists operator - sql, Assignment Help, Ask Question on Example of not exists operator - sql, Get Answer, Expert's Help, Example of not exists operator - sql Discussions

Write discussion on Example of not exists operator - sql
Your posts are moderated
Related Questions
Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that provides security l

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,

DELETE Statement The DELETE statement eliminates whole rows of data from the specified table or view. Syntax:

Consider the following set of database tables (same tables from Assignment 6-1). Please take note of foreign keys (most of them carry the same names as the corresponding primary ke

ROWID The ROWID returns the rowid (binary address) of a row in the database table. You can use the variables of the type UROWID to store rowids in a readable format. In the il

Control Structures The Control structures are the most important PL/SQL extension to the SQL. Not only does PL/SQL let you manipulate Oracle data, it lets you process the data

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

Effects of NULL for Table Expression Here's an important distinction between expressions denoting tables and expressions denoting multisets of rows: a table expression cannot

PITS Depressions in secondary cell wall is called pit. A pit present on the free cell wall surface without its partner is called Blind pit. It consists of 2 parts -

PPD , CPA, Filesharing Site Project Description: This is very easy I need a PPD , CPA, Filesharing Site. [PPD] stands for (pay per download) example hotsharecash [Files