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
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)

Question: Consider the following relations (primary keys are underlined): AUTHOR (ANo, aname, address, speciality) PUBLISHER (PNo, pname, Location) BOOK (BNo, Title, ISBN,

Implicit Cursor Attributes The Implicit cursor attributes returns the information about the execution of an INSERT, DELETE, UPDATE, or SELECT INTO statement. The cursor attribu

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

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

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Multiple Assignment- SQL SQL supports multiple assignment to local variables and also applies multiple assignment semantics in SET clauses of UPDATE statements, but does not

LOOP Statements The LOOP statements execute a series of statements at multiple times. The loops enclose the series of statements that is to be repeated. The PL/SQL provides typ

Using Host Arrays The Client-side programs can use anonymous PL/SQL blocks to bulk-bind input and output host arrays. However, this is the well-organized way to pass the colle

Dynamic Ranges The PL/SQL lets you determine the loop range dynamically at run time, as the example below shows: SELECT COUNT(empno) INTO emp_count FROM emp; FOR i IN 1..emp_cou