Closest approximation to relational union - sql, PL-SQL Programming

Closest Approximation to Relational Union - SQL

Actually, just as SQL has several varieties of JOIN, it also has several varieties of UNION, none of which is equivalent to the relational operator of that name. The closest approximation to relational union is illustrated in Example.

Example: SQL's closest approximation to relational union

SELECT StudentId

FROM IS_CALLED

WHERE Name = 'Devinder'

UNION DISTINCT CORRESPONDING

SELECT StudentId

FROM IS_ENROLLED_ON

WHERE CourseId = 'C1'

The key word DISTINCT is optional and implied by default (somewhat curiously so, considering that its opposite, ALL, is the default option in the SELECT clause). It specifies that no row is to appear more than once in the result. Thus, there is never a need to include DISTINCT in either of the SELECT clauses, and this would be the case even if the WHERE clause were omitted from the specification of the second operand in Example, allowing the same StudentId value to appear more than once in that operand.

The key word CORRESPONDING specifies that operand columns are to be paired by name, just as in relational union.

Posted Date: 1/18/2013 5:28:12 AM | Location : United States







Related Discussions:- Closest approximation to relational union - sql, Assignment Help, Ask Question on Closest approximation to relational union - sql, Get Answer, Expert's Help, Closest approximation to relational union - sql Discussions

Write discussion on Closest approximation to relational union - sql
Your posts are moderated
Related Questions
Forward Declarations The PL/SQL needs that you declare an identifier before using it. And hence, you should declare a subprogram before calling it. For illustration, the decla

Predicate - SQL Consider the declarative sentence-a proposition-that is used to introduce this topic:  "Student S1, named Anne, is enrolled on course C1." Recall that th

Autonomous versus Nested Transactions Though an autonomous transaction is started by the other transaction, it is not a nested transaction for the reasons shown below: (i)

Second Step at defining type SID in SQL CREATE TYPE SID AS VARCHAR(5) ; Explanation: TYPE SID announces that a type named SID is being defined to the system.

Transaction context As the figure shows, the major transaction shares its context with the nested transactions, but not with the autonomous transactions. Similarly, If one aut

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

heap sort program in pl/sql

Named Notation The second procedure call uses the named notation. An arrow (=>) serve as the relationship operator that associates the formal parameter to the left of the arro

How Transactions Guard Your Database The transaction is a sequence of SQL data manipulation statements which does a logical unit of work. The Oracle treats the sequence of SQL

Ensuring Backward Compatibility   The PL/SQL Version 2 permits some abnormal behavior which Version 8 disallows. Particularly, Version 2 permits you to (i) Make the forw