SQL > Advanced SQL > MinusThe MINUS command operates on two SQL statements. It takes all the results from the first SQL statement, and then subtract out the ones that are present in the second SQL statement to get the final answer. If the second SQL statement includes results not present in the first SQL statement, such results are ignored. The syntax is as follows:
[SQL Statement 1]
Let's continue with the same example:MINUS [SQL Statement 2]; Table Store_Information
SELECT Txn_Date FROM Store_Information
Result:MINUS SELECT Txn_Date FROM Internet_Sales;
Please note that the MINUS command will only return distinct values. Some databases may use EXCEPT instead of MINUS. Please check the documentation for your specific database for the correct usage. |
Saturday, 13 December 2014
SQL MINUS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment