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
Updating by insertion Syntax : INSERT INTO ENROLMENT VALUES (SID ('S4'), 'Devinder', CID ('C1'));

Using raise_application_error The Package DBMS_STANDARD that is supplied with Oracle gives language facilities that help your application to interact with Oracle. For illustra

At times, Brewbean's has changed the id number for existing products. In the past, they have had to add a new product row with the new id to the BB_PRODUCT table, modify all the co

Relational Algebra - SQL It describes some operators, that together constitute an algebra that is not only relationally complete but also irreducibly so (very nearly- apart f

BIOCHE M ICA L ORIGIN OF LIFE - It is generally agreed by astronomers, geologists and biologists that the earth is approximately 4500-5000 million years old. It is an

Restriction and AND - SQL Restriction is available via the WHERE operator, and so it is in SQL. However, by Example showing how a certain simple restriction can be expressed u

Write a query to find academics that are authors and that have only ever coauthored papers with authors from institutes in the same state as their own. List their academic number,


Perform the following queries on the Hospital1.DB using SQL Anywhere (START EARLY!). a. Which patients have purchased the drug "Tylenol"? List the names and addresses. Arrange the

Need Windows and Linux system Administrator We are seeking a part time system administrator to take care of our servers. Your things to do would add, but not limited to: -