473,473 Members | 1,906 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 13822
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)); }
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.