need help to find column ID to market sql tables in a diagram

I want to build a query that will walk all tables in a schema in a loop and compare every possibility to associate it with an ID column

I need to know what are the tables have a result where the number of lines with names of columns ID is > 0, then show that only those who were the tables & how many match. I don't know the name of the columns ID, so that does not need to be a variable

Something along the idea of (not even close to real SQL but I hope that the idea comes through)

for i = 1 to the last-1 table
for j = 2 to the last table

Select
i table_name
j table_name
County (id_column)
Of
Table i
Table j
where
i.id_column = j.id_column

Next I
Next j

then to take all lines that result and get rid of those who have zero counties

Thank you

-----
Edit
----
I seem to have bad to convey my idea, I'll try again
I can write this:
--
Select count (id_column)
Table i table j
where i.ID = j.ID
--
and I can put in each pair of tables for the entire schema, but I don't want to really put 250 + names in this pair and go through all the possibilities of each pair of tables, I'm expecting something that looks like this when finished,

County of table table
----------------------------------------
customer address 500
phone customer 1000
customers accounts 300
Chargers cusomers 0
senders address 50
......

Published by: user7733176 on January 4, 2011 04:52

user7733176 wrote:
---
Select count (id_column)
Table i table j
where i.ID = j.ID
----

select  a.table_name,
        b.table_name,
        extractvalue(
                     xmltype(
                             dbms_xmlgen.getxml(
                                                'select  count(*) cnt ' ||
                                                '  from  ' || a.table_name || ' a,' ||
                                                '        ' || b.table_name || ' b' ||
                                                '  where b.id = a.id'
                                               )
                             ),
                     '/ROWSET/ROW/CNT'
                    ) cnt
  from  user_tab_columns a,
        user_tab_columns b
  where a.table_name > b.table_name
    and a.column_name = 'ID'
    and b.column_name = 'ID'
  group by a.table_name,
           b.table_name
  having extractvalue(
                      xmltype(
                              dbms_xmlgen.getxml(
                                                 'select  count(*) cnt ' ||
                                                 '  from  ' || a.table_name || ' a,' ||
                                                 '        ' || b.table_name || ' b' ||
                                                 '  where b.id = a.id'
                                                )
                              ),
                      '/ROWSET/ROW/CNT'
                     ) > '0'
  order by a.table_name,
           b.table_name
/

SY.

Tags: Database

Similar Questions

  • Need help to find bosses and leaders out there

    Hi all

    I need help to find patterns, but also the number of occurrences of these models in the data in the column of the table.

    Consider the examples of data - column of a row in a table:

    'S-S-S-P-S-B-S-S-C-S-P '.

    My requirement is:

    I should get all the models that are followed is "."

    For example, the foregoing, given given bosses and Auditors are
    SS - count is 3
    SP - count is 2
    SB - 1 is
    SS - count is 1

    There is a condition most the above requirement:

    If' is followed by 'A', then 'SA' is not as a model. The model must stretch until a character no 'A' is found.

    Consider the sample data for the above case:

    'S-S-A-S-S-A-A-C-S-P-S-A '.

    previously given given bosses and Auditors are
    SS - count is 2
    SP - count is 1
    SAS - count is 1
    SAAC - count is 1

    The column data is stored as type VARCHAR2.

    I have Oracle Database 11 g Enterprise Edition Release 11.1.0.6.0 - 64 bit Production

    Thanks in advance,
    Girish G

    Hi, Girish,

    Girish G wrote:
    Hi all

    I need help to find patterns, but also the number of occurrences of these models in the data in the column of the table.

    Consider the examples of data - column of a row in a table:

    'S-S-S-P-S-B-S-S-C-S-P '.

    My requirement is:

    I should get all the models that are followed is "."

    Do you mean "I should get all the models who * begin by * of '?

    For example, the foregoing, given given bosses and Auditors are
    SS - count is 3
    SP - count is 2
    SB - 1 is
    SS - count is 1

    Why are there two production lines for "SS"? The other, with count = 1, mean doing just that?

    There is a condition most the above requirement:

    If' is followed by 'A', then 'SA' is not as a model. The model must stretch until a character no 'A' is found.

    Consider the sample data for the above case:

    'S-S-A-S-S-A-A-C-S-P-S-A '.

    previously given given bosses and Auditors are
    SS - count is 2
    SP - count is 1
    SAS - count is 1
    SAAC - count is 1

    The column data is stored as type VARCHAR2.

    I have Oracle Database 11 g Enterprise Edition Release 11.1.0.6.0 - 64 bit Production

    Thank you; version information are very useful.

    Thanks in advance,
    Girish G

    Whenever you have a question, please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.
    For example, the sample data may be:

    CREATE TABLE     table_x
    (       x_id     NUMBER     PRIMARY KEY
    ,     txt     VARCHAR2 (30)
    );
    
    INSERT INTO table_x (x_id, txt) VALUES (1, 'S-S-S-P-S-B-S-S-C-S-P');
    INSERT INTO table_x (x_id, txt) VALUES (2, 'S-S-A-S-S-A-A-C-S-P-S-A');
    

    and the results desired from these data can be:

    X_ID TXT                       PATTERN                          CNT
    ---- ------------------------- ------------------------- ----------
       1 S-S-S-P-S-B-S-S-C-S-P     SB                                 1
       1 S-S-S-P-S-B-S-S-C-S-P     SC                                 1
       1 S-S-S-P-S-B-S-S-C-S-P     SP                                 2
       1 S-S-S-P-S-B-S-S-C-S-P     SS                                 3
    
       2 S-S-A-S-S-A-A-C-S-P-S-A   SAAC                               1
       2 S-S-A-S-S-A-A-C-S-P-S-A   SAS                                1
       2 S-S-A-S-S-A-A-C-S-P-S-A   SP                                 1
       2 S-S-A-S-S-A-A-C-S-P-S-A   SS                                 2
    

    (Which is what you have posted, except that there is only one line of output for "SS" when x_id = 1.)

    One way to achieve these results in Oracle 11 is:

    WITH   got_s_cnt    AS
    (
         SELECT     x_id, txt
         ,     REGEXP_COUNT (txt, 'S')     AS s_cnt
         FROM     table_x
    )
    ,     cntr          AS
    (
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= (
                                   SELECT  MAX (s_cnt)
                             FROM    got_s_cnt
                               )
    )
    ,     got_pattern     AS
    (
         SELECT     s.x_id
         ,     s.txt
         ,     c.n
         ,     REGEXP_SUBSTR ( REPLACE ( SUBSTR ( txt
                                                 , INSTR (s.txt, 'S', 1, c.n)
                                    )
                             , '-'
                             )
                         , 'SA*[^A]'
                            )       AS pattern
         FROM    got_s_cnt  s
         JOIN     cntr        c  ON  c.n  <= s.s_cnt
    )
    SELECT       x_id
    ,       txt
    ,       pattern
    ,       COUNT (*)     AS cnt
    FROM       got_pattern
    WHERE       pattern     IS NOT NULL
    GROUP BY  x_id
    ,            txt
    ,       pattern
    ORDER BY  x_id
    ,            pattern
    ;
    

    At the heart of this query is the call to REGEXP_SUBSTR:

    REGEXP_SUBSTR ( x
               , 'SA*[^A]'
               )
    

    who is looking:
    S = the letter S
    A * = the letter A, 0 or more times
    [^ A] = nothing, except the letter A

  • Need help to find and install the game Chess Titans Windows Vista for XP

    Need help to find and install the game Chess Titans Windows Vista for XP

    Hi SBOYDC130guy,

    We will not be able to install titan of failures on windows XP because it is designed for Windows Vista and Windows 7 and it's built-in game.

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • need help to find the windows vista key

    need help to find windows vista key product I lost my kit, but I have windows vista cd/dvd. Please answer me as soon as posssible, thank you

    http://magicaljellybean.com/KeyFinder/

    Use the program above to find the product key in your operating system Vista running and active.

    If a desktop computer: Watch next or back.
    If a laptop: look on the underside.

    If a recovery disk, most of the manufacturer's recovery disks do not need a product key to get back to factory settings.

    This is the limit of the help that we can give you a missing product key.

    See you soon. Mick Murphy - Microsoft partner

  • I JUST DOWNLOAD THE CC ON MY DESKTOP N HAVE NO IDEA WHERE TO START PHOTO EDITING IT S LITTLE DIFFERENT OF MY ITEM 12 NEED HELP TO FIND THE TUTORIAL THANK YOU A.S.A.P.

    I JUST DOWNLOAD THE CC ON MY DESKTOP N HAVE NO IDEA WHERE TO START PHOTO EDITING IT S LITTLE DIFFERENT OF MY ITEM 12 NEED HELP TO FIND THE TUTORIAL THANK YOU A.S.A.P.

    Start with the tutorials in the Welcome window to start and takes a course from a site like Lynda.com.

  • Need help to find the "main point size.

    Hello

    I need help to find the "main point size.

    Any style of Pará which is more than 2 points of my font size, I need the alert message "His more than 2 points for your font size". For example, the font size of my para 10 here is my attack should be 12 points rather than his 14 points, I need the alert message.

    Is it possible by script?

    by

    hasvi

    Hi Hasvi,

    Try this.

    var doc = app.activeDocument;

    var texts = doc.stories.everyItem ().textStyleRanges.everyItem () .getElements ();

    pstyle var = ' Suite of paragraph styles have more leadings: \r\r ";

    for (var i = 0; i)<>

    {

    PS var = text [i] .pointSize;

    If (texts [i] .leading > ps + 2).

    {

    pStyle += text [i].appliedParagraphStyle.name;

    }

    }

    Alert (pStyle)

    While it is true that mark as answer correct and do not select your question as a correct answer.

    Kind regards

    Cognet

  • HP-15f039wm: need help to find the driver

    I got lost. need help finding the (USB) Universal Serial Bus controller. would be very grateful for help.

    Hello

    Try the driver on this link.

    http://ftp.HP.com/pub/SoftPaq/sp66001-66500/sp66211.exe

    Kind regards

    DP - K

  • I need help to find the correct version of the BIOS.

    As the title says I need assistance to find the correct version of the BIOS and now I have P02 - A2: 2011-10-31 and an Acer G3610 predator.

    I need an update is because I bought a new CPU and when I start the computer, it starts only for like 2 sec then turns off then on again one then it emits a beep of 3 or 4 times, then he is leaving and on but never goes Windows just a black screen so my guess is that I have an older version of the bios that does not recognize the CPU.

    Nope.

    I think they changed the revision of the motherboard, so you can't Flash this BIOS on your system.

    That's why you have a size mismatch error.

    So, you can not upgrade to Ivy bridge, sorry.

  • Need help to find and replace

    Hi all

    I need assistance to find and replace words between \ make "BOLD" and delete the symbol in my pages just like below.

    Text example:

    He astonished his parents by \turning a childhood obsession\ in a decent-paying career, much to their dismay.

    After the text:
    He astonished his parents by turning a childhood obsession into a decent-paying career, much to their dismay.

    Thanks in advance,

    Siva

    (\\+?) will never return more than 1 backslash because the? is telling to find the shortest match. {I would change that to each (\) or (\\{2)}

  • Urgent need help with find and change / GREP

    I'm working on a manual that contains more than a thousand paintings. I'm not quite familiar with GREP and need help to determine the right to coding/jokers to change the character style to a group of words/numbers on a global basis.

    For example, in Chapter 7, a paragraph style is applied to this line of text:

    TABLE 7.1: T4, T3, FREE T4 AND FREE T4ED

    I need to change "table 7.1:" for a character style and so of suite/so on up to "Table 7,150:"-while leaving the other numbers on the same line unchanged also.»» Is it possible to do without having to manually each table style number?

    gd247 wrote:

    I'm working on a manual that contains more than a thousand paintings. I'm not quite familiar with GREP and need help to determine the right to coding/jokers to change the character style to a group of words/numbers on a global basis.

    For example, in Chapter 7, a paragraph style is applied to this line of text:

    TABLE 7.1: T4, T3, FREE T4 AND FREE T4ED

    I need to change "table 7.1:" for a character style and so of suite/so on up to "Table 7,150:"-while leaving the other numbers on the same line unchanged also.»» Is it possible to do without having to manually each table style number?

    No need for GREP. If "TABLE 7.1:" is text, you can create a nested character style that extends through the colon, in the paragraph style. "

    If "TABLE 7.1:" is created by a numbered list of automatic type paragraph style, you can specify a character style named for the part of automatic numbering in the drop-down menu Style of character, in the Style of numbering of the chips section and numbering of the dialog box Options of paragraph style. If the character style does not exist, you can stay in the operation of paragraph options by choosing 'New Style of character' in the menu. After you create the new style, you're back in the process of definition of the paragraph.

    HTH

    Kind regards

    Peter

    _______________________

    Peter gold

    Know-how ProServices

  • Need help to reduce the cost of my sql Query below 100 to optimize.

    Can you please suggest how to reduce the COST of my SQL query? Is it possible to get the < 100 COST?

    My goal:
    ------------------------

    To recover the data of length (a column is in normalised_event: table) corresponding to each type of call (which is to extract the column rc.abbreviation in reference_code: table) in a given range of dates. So I wrote the following as SQL below:

    ------------------------------------------------------------------------------------------------------------------
    Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
    Since the rc reference_code, normalised_event not
    where to_char (rc.reference_code) = ne.full_path
    and rc.reference_type_id = 505002 AND
    trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
    and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
    Rc.abbreviation group

    -----------------------------------------------------------------------------------------------------------------

    IAM using Toad Software which is taken in charge by oracle 9i.


    Explain the plan above query is:

    explain plan
    Set statement_id = "mp01" for
    Select nvl (sum (round(ne.duration/60,3)), 0), rc.abbreviation
    Since the rc reference_code, normalised_event not
    where to_char (rc.reference_code) = ne.full_path
    and rc.reference_type_id = 505002 AND
    trunc (don't. CHARGE_START_DATE) between trunc (to_date (January 1, 2008 "," dd-mm-yyyy hh24:mi:ss'))))
    and trunc (to_date (January 1, 2009 "," dd-mm-yyyy hh24:mi:ss'))))
    Rc.abbreviation group



    Select LPad (' ', 2 *(Level-1)). Level | '.' || NVL (position 0). ' ' ||
    Operation | ' ' || Options of | ' ' || Object_name | ' ' ||
    Object_type | ' ' || Decode (id, 0, Statement_Id |) "Cost = ' | Position)
    "Query plan.
    From Plan_Table
    Start with id = 0 and Statement_Id = 'mp01 ".
    Connect Id Parent_Id = prior
    And Statement_Id = 'mp01 ";


    ---------------------------Query Plan explained is----------------------------------------------------------

    1.555 INSTRUCTION SELECT mp01 cost = 555
    2.1 TYPE GROUP
    3.1 FILTER
    4.1 HASH JOIN
    5.1 TABLE ACCESS BY INDEX ROWID REFERENCE_CODE
    6.1 INDEX RANGE SCAN NON-UNIQUE I_REFERENCE_CODE_REF_TYPE
    5.2 PARTITION RANGE ALL THE
    6.1 TABLE ACCESS FULL NORMALISED_EVENT

    -Automatic tracking of the SQl query is:.

    recursive calls - 0
    DB block gets - 0
    compatible gets - 174
    physical reads - 0
    size - 104
    Parse count (hard) - 0
    Parse count (chess) - 0
    run the County - 2
    bytes sent via SQL * Net to dblink - 0
    bytes received via SQL * Net from dblink - 0

    I was wrong. Once again, this shows how it is dangerous to assume (I assumed that FBI was new in 10g because it is when I used them), and the power of the community to ensure that accurate information is provided.

    John

  • Help the fetaching data in dynamic PL/SQL tables

    Hello

    I'm develioping a PL/SQL procedure in which I'm 24 tables of PL/SQL creation of the same type.

    But while inserting data in them, I need to use the table dynamically names for example, immediate enforcement to put the data in the tables would remain even just I need for each loop for the Execute immediate statement, it must use the name in the other table.



    See the code example below:

    Varchar2 column (20);
    Type RA_TABLE is table of the CALL_DETAIL_EXCEPTION. TYPE % IC_CIRCT_GR_CD
    index of directory;

    MY_RA1 RA_TABLE;
    MY_RA2 RA_TABLE;
    MY_RA3 RA_TABLE;
    MY_RA4 RA_TABLE;


    BEGIN

    for idx in 1.cnt_interval loop

    Column: = "MY_RA" | IDX;

    Query1: = 'select Trunk_info bulk collect INTO MY_RA | IDX |' dbl.vw_cgi v where there is no (select 1 of dbl.varun f
    where f.ic_circt_gr_cd = v.TRUNK_INFO and f.call_gmt_dnect_dt_time between
    to_date('''|| stime ||'') (', "yyyymmddhh24miss") and to_date('''|| eTime ||'') ((', 'yyyymmddhh24miss'))';


    Now, when I run this code, it gives me an error for query1 saying that it's a function not implemented in Oracle.


    He is not able to choose this dynamic table name.

    Help, please!
    dbms_output.put_line(l_outertab(1)(1));
    
  • Need help to find what is REALLY to my advantage?

    I bought what I said was a ThinkPad Edge 530, with a processor i5, 6 GB of memory, a numeric keypad and running @ 7 200 RPM. When he arrived, he had not the numeric keypad. The seller told me that the keypads were not available at the edge. (Strange, the same one @ Costco was one in the picture... Then he told me it is available in a month after I purcahsed mine as well as all the brochures Lenovo just had the edge. s in the picture like that! Oh MY!)

    I have problems with the load. The battery icon at the bottom left shows 95% available, hip; no charging in progress". The seller sent to the manufacturer for me (at the same time charge me over $ 100!) and when I came back, nothing has been fixed.

    I called IBM on the problem and inquired about the keyboard... The pavement WAS available when I bought my pc! So, I thought-lied to me once... I asked what was the 'courage' of my pc. It has 4 GB of memory and is running @ 5 400 rpm.

    IBM said it was even not an E530, but an edge of 15...

    Lenovo said they have never heard of an edge of 15, that it IS an E530 (this is what is on my invoice)

    I asked Lenovo where I can find what is in my SPECIFIC laptop, and they tell me that they cannot help me. I know that I can (and have) entered my pc in 'Computer' and click right, etc... But, I need a print out of the company itself; take either the seller or the Court.

    Can someone please give me a link? My ThinkPad type 0319. Of course, I am a computer novice, or I wouldn't have gotten into this situation! It won't happen again. I appreciate any assistance. Thank you very much!

    Note of the moderator; s/n, edited for the protection of its own

    Edge 15 is not an edge E530. Edge 15 has been replaced by Edge E520, then edge E530. But it is still sold in the market of NA, a spec like you shouldn't cost more than $ 500 (closer to 300 or 400 is better like that) at most.

    Only 15 flight attendants had not the keypad, the Edge E520 and E530 times had on the numeric keypad.

    You can download a software called HWinfo32 from the web, and it will tell you the exact specification of your machine, i.e. CPU.

    The seller is you ripped off as a crook, and the support of IBM technology has no idea what he said.

    http://www.ThinkPads.com/wp-content/uploads/2010/03/Lenovo_ThinkPad_Edge_15.PNG   <---- edge="">

    http://www.bitdynasty.com/images/comparison/notebooks/Lenovo/Lenovo-ThinkPad-edge-e520d.jpg  <--- edge="">

    http://www.laptopreviews.com/wp-content/uploads/2012/05/IMG_0470-001.jpg  <--- edge="">

    Here is the official list of specifications of the laptop Edge series:

    http://www.Lenovo.com/PSREF/PDF/edgebook.PDF

    Note that the edge 15 would have the first generation I core CPU:

    I guess you have to be the next CPU:

    1 i3-380 2.53 ghz
     
    or

    2 i5-540 2.53 ghz.

    Two of these CPUS were used in the on-board computer 15 (they are called Arrandale CPU), Edge E530 use Sandy Bridge or Ivy Bridge CPU.

  • Need help to find an adapter for a third-party monitor

    Hi all! I find myself in need of a little guidance, and I hope that someone out there will have a quick n easy for me...

    I have a Mid-2011 27 'iMac. which has two ports Thunderbolt It is taken with a Wacom tablet that I use constantly, and the other is made by an external hard drive to a solid state, which has a built-in cable to Thunderbolt (no way to hang it on a different port). I also have a 27 "HP monitor that is currently connected via an HDMI USB adapter.

    The problem is that the HP monitor is actual "jiggy" - the USB does not seem fast enough to deal with requests for the monitor. It is almost unusable. I know I should run it via a HDMI adapter Thunderbolt, but as I have already mentioned the two my Thunderbolt ports are already in use.

    Someone at - it ideas? I need sort of three to two ports Thunderbolt hooks, but I can't seem to find anything for less than $300 that would work. (I am illiterate when it comes to the different cables, adapters, ports, etc., so I hope someone can point me in the right direction by using short words... Most of the products that I travel through list specifications that me Chicane).

    The monitor has two HDMIs and a VGA port, and my iMac has a Firewire 800 port, if that helps at all...

    2011 iMac have only 1 Thunderbolt port and there is no such thing as a Mid-2011, you must have an iMac of year later, if it has 2 ports Thunderbolt. All the 27 "iMacs, from 2012 to 2015 the current have 2 ports Thunderbolt.

  • need help to find the folder of firefox on iMac

    New to this bear so please with me.  Here's the situation.

    I was getting malware and understand how to get rid of it, ok so far.

    Then I noticed that my sites kept has the question 'connection' in the top bar.

    I was trying to figure this out when I followed some information 'to a point' - big flaw here.

    I caught and then drag to a folder that was causing my problem.  It was not the case.

    I think it was my firefox profile folder, but the folder is not sure - klzqb90r.default.

    Put in the trash.  Oops again.

    Tired opening Firefox - come with LACK of PROFILE error message - your firefox profile cannot be loaded.  It may be missing or inaccessible.

    I think I got it but now, just do not know where to put it.

    So, read more.  Search for the library and the firefox folder, is not there.

    Now I am panicking because I can't open firefox to do 'something' to him to try to find my profile / refresh etc.

    Can someone please help?  I think I need to find the correct folder that belongs to my folder by default, BUT am not a guru of computing here... some understanding of computers.

    Thank you.

    In the menu go to the Finder, select "go to folder...". "(Shift + command + G)

    Type or paste in

    ~/Library/application support/Firefox/Profiles

    return.

Maybe you are looking for

  • How leave you full screen

    I accidentally went from my normal screen mode full screen, and can not find a way to leave. I'm constantly looking for the menu bar. TIA

  • Error in PC Express on Qosmio G40

    Hello I've owned my Qosmio again for 2 years. Its a Qosmio G40 and it worked very well. Recently, I updated to Windows 7Monday/Tuesday night, I had one of these standard windows updates that settle after clicking stopNext morning, I turned on and get

  • Re: Satellite Pro A120: cannot select an option on the recovery disk

    Hello I have a Toshiba Satellite Pro A120, which has recently been faced with the "alert: System protection failure! "password:" problem that it turned up on some BIOS password unknown on its own in the middle of normal operation. I got that fixed lo

  • Pavilion 23-q000na (touchsc: no sound on new Pavilion 23-q000na)

    Why is there no Audio data (System or otherwise - iTunes / CD / DVD, etc.) on my brand new all in one touchscreen desktop? During the initial installation, I upgraded the operating system to win 10. The computer has B & O sound and I would really lik

  • difficulty to remove the network wireless to my laptop

    Hi - I'm unable to remove the network my laptop wireless. I have windows Vista Home premium on a Dell Inspiron 1525. I need to delete the list of wireless network in order to re - install (due to changes to the security settings). When I try to remov