473,378 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MINUS operator - How it works.!!??

Hi,
Could someone please tell how MINUS operator works for comparing and
giving non-matching records in Table1? Does MINUS operator compares
all records of Table1 with all records of Table2 to give differences?
Say, i've got 2 tables - no keys defined on them. No PK and UK. Now
MINUS operator will pick which columns for comparison? Having a PK/UK,
i see it as comparing these keys and susequently the rest of fields
for matcing key records, thereby reporting non-matching records from
Table1. Say, if both Table1 and Table2 have 300,00 records each. Now
how many comparisons would this result in?

Someone please light a bulb on me... or direct me to some good links
that would clear my doubts on this.

TIA
Jul 19 '05 #1
2 13814
Newbie wrote:
Hi,
Could someone please tell how MINUS operator works for comparing and
giving non-matching records in Table1? Does MINUS operator compares
all records of Table1 with all records of Table2 to give differences?
Say, i've got 2 tables - no keys defined on them. No PK and UK. Now
MINUS operator will pick which columns for comparison? Having a PK/UK,
i see it as comparing these keys and susequently the rest of fields
for matcing key records, thereby reporting non-matching records from
Table1. Say, if both Table1 and Table2 have 300,00 records each. Now
how many comparisons would this result in?

Someone please light a bulb on me... or direct me to some good links
that would clear my doubts on this.


The answer is documented at http://tahiti.oracle.com
go RTFM for enlightenment

Jul 19 '05 #2
"Anna C. Dent" <an******@hotmail.com> wrote in message news:<sOeub.23702$Q64.11116@fed1read03>...
Newbie wrote:
Hi,
Could someone please tell how MINUS operator works for comparing and
giving non-matching records in Table1? Does MINUS operator compares
all records of Table1 with all records of Table2 to give differences?
Say, i've got 2 tables - no keys defined on them. No PK and UK. Now
MINUS operator will pick which columns for comparison? Having a PK/UK,
i see it as comparing these keys and susequently the rest of fields
for matcing key records, thereby reporting non-matching records from
Table1. Say, if both Table1 and Table2 have 300,00 records each. Now
how many comparisons would this result in?

Someone please light a bulb on me... or direct me to some good links
that would clear my doubts on this.


The answer is documented at http://tahiti.oracle.com
go RTFM for enlightenment


I looked at the documentation related to minus and did not find the
organization that useful in light that I believe the question is
directed at determining how Oracle actually goes about solving a minus
operation rather than what minus produces or how to use the minus
operator. As such I do not think the answer is in the documentation
though the documentation should clear up some of newbie's confusion
related to his or her comments on PK.

Newbie, Logically when you use the minus operator you are asking for
all the rows in A that are not in B. This can be thought of as an
outer join of B to A so that all the rows in A are returned but you
discard the matching rows leaving only the rows in A that have no
match in B. I believe this is called an anti-join. The match is
performed on all columns in the select list so the presence or absense
of keys do not matter; duplicates are eliminated.

How Oracle goes about solving the query internally is not our concern
in that Orcle could potentially change the internal methods employed
at any time. You can run explain plan and trace files to see what
Oracle is doing for a specific query.

HTH -- Mark D Powell --
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joe | last post by:
Hello, Hopefully you sql guru's can help me out a bit. :) Here is the short example of what I want to accomplish. I wish to have the difference between two different select queries. So if...
2
by: Frederic Rentsch | last post by:
Hi all, I have a class Time_Series derived from list. It lists days and contains a dictionary of various Lists also derived from list which contain values related to said days. (e.g. Stock...
6
by: Matthew Cook | last post by:
I would like to overload the unary minus operator so that I can negate an instance of a class and pass that instance to a function without creating an explicit temporary variable. Here is an...
1
by: mymurali24 | last post by:
i need synat for minus operator in my sql
6
by: Nelsupremo | last post by:
I am not fluent in overloading stuff .. there was a question that I can across on net .. any bright ideas? The program will contain a class Matrix, This class will contain a private data member...
2
by: CenturionX | last post by:
Hello everybody i'm trying to use the minus operator like that: (SELECT DISTINCT TRIM(S.Lname & ', ' & Fname) AS Name, S.SID FROM Salesperson as S, Schedule as H WHERE S.SID = H.SID AND H.Day =...
2
by: Shalini Bhalla | last post by:
I want to extract records form a table . I have Table A and Table B . I want to extract unmatching records from table A to table B .... Can you Please tell me how to extrat it ? How to...
2
by: Newbie | last post by:
Hi, Could someone please tell how MINUS operator works for comparing and giving non-matching records in Table1? Does MINUS operator compares all records of Table1 with all records of Table2 to...
2
by: avixt | last post by:
//like this. please answer..... int main() { float num = 4.2; printf(" %f\n",(num << 1)); }
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.