Good Day everyone!
I need urgent help on this.
I have to tables with both having 8 primary keys. Both having more than 25,000 records above. I need a script that will determine which record in one of those two tables doesnt exist in the other table(meaning has no related data using the 8 primary keys). The established relationship using the 8 primary keys is always 1:1.
Need your assistance, everyone.
Regards
1 1374
Good Day everyone!
I need urgent help on this.
I have to tables with both having 8 primary keys. Both having more than 25,000 records above. I need a script that will determine which record in one of those two tables doesnt exist in the other table(meaning has no related data using the 8 primary keys). The established relationship using the 8 primary keys is always 1:1.
Need your assistance, everyone.
Regards
First... 8 fields yikes!! you should consider using a surrogate key (sequence field) as the primary key and just use a unique index on the 8 fields making up the primary key.
as to your question you could do a minus between the two tables, remember to do it both ways because you want to know which rows in either table doesnt have a like row in the other. Minus only finds it one way, so for example -
Connected to:
-
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
-
With the Partitioning, OLAP and Data Mining options
-
-
[144]dave@ORADB> create table t1 (col1 number);
-
-
Table created.
-
-
Elapsed: 00:00:00.42
-
[144]dave@ORADB> create table t2 (col1 number);
-
-
Table created.
-
-
Elapsed: 00:00:00.04
-
[144]dave@ORADB> insert into t1 values (1);
-
-
1 row created.
-
-
Elapsed: 00:00:00.00
-
[144]dave@ORADB> insert into t2 values (2);
-
-
1 row created.
-
-
Elapsed: 00:00:00.00
-
[144]dave@ORADB> select col1 from t1 minus select col1 from t2;
-
-
COL1
-
----------
-
1
-
-
Elapsed: 00:00:00.01
-
[144]dave@ORADB> select col1 from t2 minus select col1 from t1;
-
-
COL1
-
----------
-
2
-
-
Elapsed: 00:00:00.00
-
[144]dave@ORADB> SELECT col1, 'T1' tab FROM t1 minus SELECT col1, NULL FROM t2
-
2 UNION SELECT col1, 'T2' tab FROM t2 minus SELECT col1, NULL FROM t1;
-
-
COL1 TA
-
---------- --
-
1 T1
-
2 T2
-
Elapsed: 00:00:00.00
-
with 25K rows in each table this should be fine, but i wouldnt use it on tables with many millions, it could get really slow.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: toedipper |
last post by:
Hello,
I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor
etc etc
For the table design I am...
|
by: John |
last post by:
I'm trying to normalize my database the best I can this time around and I'm
running into some trouble. I've been avoid normalizing for a long time now
because while I know how to normalize, I'm...
|
by: Larry R Harrison Jr |
last post by:
I have an Access 97 database with 2 tables that have a one-many
relationship. I have a SQL statement in the "one" table which I want to
execute and insert 7 records into the "many" table, and I...
|
by: Sami |
last post by:
Please bear with me, and if you answer this question, please do it
step by step. I am new at Access, not at all sophisticated. I am
using Office XP. This will need to be read in Access for...
|
by: Ed |
last post by:
I am running Access 2002 and just ran the built in Access wizard for
splitting a database into a back end (with tables) and front end (with
queries, forms, modules, etc.).
After running the...
|
by: Mason |
last post by:
I have a table consisting of people and their attributes. I would
like to create a relationship matrix table that records the
relationships between the people. So the two tables would look...
|
by: PAUL |
last post by:
Hello,
I have 2 tables with a relationship set up in the dataset with vb
..net. I add a new record to the parent table then edit an existing child
record to have the new parent ID. However when I...
|
by: phil-news-nospam |
last post by:
Is there really any advantage to using DIV elements with float style
properies, vs. the old method of TABLE and TR and TD?
I'm finding that by using DIV, it still involves the same number of...
|
by: MMcCarthy |
last post by:
Normalisation is the term used to describe how you break a file down into tables to create a database. There are 3 or 4 major steps involved known as 1NF (First Normal Form), 2NF (Second Normal...
|
by: BD |
last post by:
Hi, all.
I need to enforce a one-to-many relationship on 2 tables, with a join
table.
Say the join table contains account information. It has cust_no and
acct_no. Both cust_no and acct_no are...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |