Talk:Set operations (SQL)

Merge
One could reasonably write an article about union in databases along with common implementations, examples, and so on, but we don't need articles on individual SQL commands. Merge into SQL. Deco 19:39, 27 January 2006 (UTC)


 * I'm against the merge. I'm trying to clean up the database articles, and what I'd like to do is get the SQL operators defined much better than they are now. That would result in a description of the underlying algebra (independent of SQL), and result in an article that's a little too large if the statements are all lumped into one. It also problably means we rename the article "UNION (database)". -- Mikeblas 18:37, 6 June 2006 (UTC)


 * There's not a one-to-one correspondence though between relational algebra operators and SQL operators. I'm not sure how this would work out. Deco 20:31, 6 June 2006 (UTC)


 * Merging Union (SQL) into SQL would be akin to merging addition into mathematics. SQL is not a complex language, but the myriad nuances of each command, statement, and operator makes a good argument for segregating them into their own articles.  CodeNaked 15:24, 20 September 2006 (UTC)
 * I agree; I think this is a valid article unto itself. Kaimiddleton 06:42, 21 September 2006 (UTC)

If there are no immediate and rational objections, I will remove the merge suggestion tag from the page tomorrow. CodeNaked 14:44, 21 September 2006 (UTC)

I would suggest to rename this topic to something like "Set operations (SQL)" and to combine the information for UNION, INTERSECTS, EXCEPT, ... here. Granted: UNION [ALL] is the set operation that is most commonly used. So a redirect from "Union (SQL)" to the new topic would be ideal. --Stolze 07:39, 25 October 2006 (UTC)
 * I concur with Stolze. Combine UNION, INTERSECT, EXCEPT, UNION ALL, etc., into one topic and redirect the individual statements to that article. SqlPac 04:58, 17 May 2007 (UTC)
 * While we're on the topic, I would also recommend doing something similar with the DML statements, INSERT, UPDATE, DELETE, and MERGE (at least). The same could be considered for DDL statements.  SELECT is the only SQL statement you could really write up more than a stub on.  I'll suggest on those pages later, but I figure the people here are probably the same ones who edit those pages as well. SqlPac 05:00, 17 May 2007 (UTC)

POLICY DEBATE: Use of source code and other examples in articles
Someone started a policy debate concerning the use of source code in articles, that seems to directly impact this (and possibly other Database articles). See below for details:

I have opened a debate on the use of source code and other examples in Wikipedia articles. It seems that many pieces of example source code etc. currently in Wikipedia violate Wikipedia policy, so we need to either clarify or change the situation. Depending on the result of the discussion, this may result in a number of source code examples being summarily removed from computing articles!

Please reply there, not here, if you wish to contribute.—greenrd 10:50, 18 May 2007 (UTC)

Thanks.SqlPac 15:09, 18 May 2007 (UTC)

Intersect Example
The example given for INTERSECT seems wrong:

The following example  query returns all rows from the Orders table where Quantity is between 50 and 100.

Shouldn't this return between 50 and 200? Wouldn't the correct example limit the first query to BETWEEN 1 AND 100 (instead of 900)?

--Qole (talk) 20:25, 20 July 2010 (UTC)

Union
The description of Union in the main article seems to suggest that the two tables being unioned do not have to have the same column names as long as the data types and number of columns match. Is this true?


 * In SQL, the column names do not have to match. The number of columns have to be the same, and the columns being unioned from each table have to be "compatible" -- that is, they don't have to be the exact same data type, but they have to be able to be cast to an appropriate data type.  Note that casting is performed based on data type precedence rules, although there may be differences in data type precendences between different SQL DBMS implementations.  The column names from the "left-hand" query (the query that appears before the UNION keyword) are used to name the result set.  SqlPac 04:42, 19 July 2007 (UTC)

MINUS
It must have been a MS Sql person who wrote the EXCEPT section, because MINUS is the SQL Standard, and EXCEPT is MS SQL's variant, not the other way around like it says in the article. 20:45, 18 June 2009 (UTC) —Preceding unsigned comment added by Firefight (talk • contribs)