Find the key referenced foreign Table and column

Can someone please refresh my memory?

How can I determine which table and column refers to a foreign key?

For example, with select * from ALL_constraints WHERE TABLE_NAME = 'my_table '; I can see forced CONSTRAINTA_FK and CONSTRAINTB_FK I guess reference another table and column because CONSTRAINT_TYPE = "R", but it isn't that I get. "

I would get all the way to the referenced table and the column I just don't remember how.

Thank you

Lou

Hello

Example:

Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr

SQL>
SQL> SELECT UC.TABLE_NAME,
  2         UC.R_CONSTRAINT_NAME,
  3         UCC.TABLE_NAME,
  4         UCC.COLUMN_NAME
  5    FROM USER_CONSTRAINTS  UC,
  6         USER_CONS_COLUMNS UCC
  7   WHERE UC.R_CONSTRAINT_NAME = UCC.CONSTRAINT_NAME
  8     AND uc.constraint_type = 'R'
  9   ORDER BY UC.TABLE_NAME,
 10            UC.R_CONSTRAINT_NAME,
 11            UCC.TABLE_NAME,
 12            UCC.COLUMN_NAME;

TABLE_NAME                     R_CONSTRAINT_NAME              TABLE_NAME                     COLUMN_NAME
------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
COUNTRIES                      REG_ID_PK                      REGIONS                        REGION_ID
DEPARTMENTS                    EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
DEPARTMENTS                    LOC_ID_PK                      LOCATIONS                      LOCATION_ID
EMPLOYEES                      DEPT_ID_PK                     DEPARTMENTS                    DEPARTMENT_ID
EMPLOYEES                      EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
EMPLOYEES                      JOB_ID_PK                      JOBS                           JOB_ID
JOB_HISTORY                    DEPT_ID_PK                     DEPARTMENTS                    DEPARTMENT_ID
JOB_HISTORY                    EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
JOB_HISTORY                    JOB_ID_PK                      JOBS                           JOB_ID
LOCATIONS                      COUNTRY_C_ID_PK                COUNTRIES                      COUNTRY_ID
TEMP_LEAVE                     PK_CLIENT                      CLIENT                         CLIEND_ID
VISITORS                       SYS_C004169                    GROUPS                         GROUPID
VLANGS                         SYS_C004170                    VISITORS                       VISITORID

13 rows selected

SQL> 

In the output:

TABLE_NAME                     R_CONSTRAINT_NAME              TABLE_NAME                     COLUMN_NAME
------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
COUNTRIES                      REG_ID_PK                      REGIONS                        REGION_ID

means that a COUNTRY table has a foreing key called REG_ID_PK that points to an array of AREAS. REGION_ID
Kind regards

Published by: Walter Fernández on March 4, 2009 23:26 - adding explanation...

Tags: Database

Similar Questions

  • put the query iresults n tables and columns

    Hello, I have this request and should display
    but I need to be in cells as the rows and columns. just like an ecxel spread sheet but only in html.

    Here's the code.
    what I need to add to make this happen?
    Thanks in adv


    < name cfquery = "replace".
    DataSource = "#request. MainDSN #">"
    SELECT
    CompanyID,
    CompanyName,
    Address,
    City,
    State,
    Zip code
    Comments
    Of
    Company
    ORDER BY
    CompanyName ASC
    < / cfquery >

    < html >
    < head >
    ColdFusion MX Bible < /title > < title >
    < link rel = "stylesheet" href = "styles.css" >
    < / head >

    < body >

    List of companies < h1 > < / h1 >

    < table >
    < b >

    < td > < b > ID < /b > < table >
    < td > < b > name < /b > < table >
    < Td > < b > < /b > < table > address
    City of < td > < b > < /b > < table >
    < td > < b > status < /b > < table >
    < td > < b > ZIP Code < /b > < table >
    < td > < table >
    < /tr >
    < cfoutput query = "replace" >
    < b >

    < td > #CompanyID # < table >
    < td > #CompanyName # < table >
    < td > #Address # < table >
    < td > #City # < table >
    < td > #State # < table >
    < td > #ZipCode # < table >
    < td >
    < a href = "EmployeeList.cfm? CompanyID = #CompanyID #"> employees < /a >"
    < a href = "CompanyAddForm.cfm" > add < /a >
    < a href = "CompanyEditForm.cfm? CompanyID = #CompanyID #"> edit < /a >"
    < a href = "CompanyDeleteForm.cfm? CompanyID = #CompanyID #"> delete < /a >"
    < table >
    < /tr >
    < / cfoutput >
    < /table >

    < / body >
    < / html >
    ---
    When displayed, it's like
    List of companies
    ID name address City State ZIP Code
    27 555 k ddd ddd dd 90556 employees add edit delete
    26 555 k ddd ddd dd 90556 employees add edit delete
    31 dd dd dd dd 89995 employees add edit delete
    23 ddd ddd ddd dd 90556 employees add edit delete
    22 ddd ddd ddd dd 90556 employees add edit delete
    24 ddd ddd ddd dd 90556 employees add edit delete
    21 mama 252 los angeles ca 90056 employees add edit delete
    5332 Courtland Court Abilene AL 29555 employees of 14 homemade pies my add edit delete
    25 nknknk ddd ddd dd 90556 employees add edit delete
    15 Normwelland and Drake Clothing Co. 1240 Pierpont Point Boston MA 02134 employees add edit delete
    Pizza Palace 1548 16 Point culminating Freeway New York NY 00248 employees add edit delete
    29 qqqq 888 laverne za 90000 employees add edit delete
    30 qqqq 888 laverne za 90000 employees add edit delete

    13 the very big Corporation of America 5806 Glenn Hollow Lane Norcross GA 30071 employees adds change remove
    -----------------------
    without the cells/folders >

    Take a HTML Manual, waiting to change

    TO

    for the grid around all

  • Hi, I bought a new computer and I want to transfer my Phtoshop CS6 license, but I can't find the key. I've only got my Bill. What I could do. Thank you. Nicolas

    Hi, I bought a new computer and I want to transfer my Phtoshop CS6 license, but I can't find the key. I've only got my Bill. What I could do. Thank you. Nicolas

    You will need to contact support by calling/chat for this request.

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

  • Comment of tables and columns are included in the Data Modeler

    Hi all
    I used Oracle SQL Developer Data Modeler (Version 3.0.0.665) and created a data model for my project. I sent an email a PDF version of the data model to our systems analyst. She asked if I could re - create the data model and include table and column comments. Is this possible and if so how this work is it?

    Thank you for your comments,

    Seyed

    Seyed salvation,

    I used the Data Modeler and create a report. The report included 36 .csv files

    What is the purpose of this 'report' task, because 36 files csv does not sound like report to me. Watch "files > reports" feature - you can generate reports for your model. -for any model, single table or tables belonging to specific subview. The report of the complete table contains additional details, so if you need these comments, then only you can create a template and select column comments appear only. So some general information table will be also included.

    Philippe

  • How to find the key

    Is there a quick way to find the key of a song or instrumental that has been imported to the logic?

    No, you need a little music for this. I guess you could find it difficult to play with a keyboard and hear/guess the agreements/key?

    Here would be my suggestion for a workaround - if it is an entire song, as you indicate in your question:

    -To get agreements on a Web site

    -See if you can find the original version of keys (that would be easy, right?)

    - Then play these chords along your song imported. If they sound not right, transpose your up and down by steps MIDI track until it sounds right. -> Get your agreements and the key.

    If your song doesn't have agreements to seek, find parts of the song where you lift clear of bass notes (not too much battery), EQ everything, taking Tuner in pop in the track and see if you can pick up the dominant notes. That should lead you to your key of song.

  • Where to find the key of Windows 8 on DVD Lenovo?

    Hello!

    Recently, I had problem with booting and installing Windows 8 via the Lenovo installation DVD. I downloaded Windows 8 Microsoft Official site and created the bootable USB key.

    My Windows 8 is still not activated, because I can't find the key on the cover of the DVD or DVD itself. I only got the number P/N on DVD.

    How to find a key on my Lenovo Win8 DVD's? Maybe it is recorded somewhere inside files on DVD?

    Any help appreciated.

    I found out I got the DVD, Lenovo were only Windows 8 drivers and no OS. Therefore, there is no KEY to be found.

  • How to get the string (specified by row and column) of txt file with labview

    Hello world

    How to get the string (specified by row and column) of txt file with labview

    THX

    As far as I know, a text file has no column.  Be more specific.  Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character?  You can read from the spreadsheet String function and set the delimiter to a space.  This will produce a 2D channels table.  Then use the table to index and give the line number and column number.

  • Try to find the key of 25 numbers for windows upgrade

    I am a student at Ivytech. -South Bend Po and purchased 10 windows and I can't find the key to upgrade 25-digit number at the bottom of the journal. Can someone help me?

    Hi Robert

    There is no version of Windows ' 10'.

    You talk about Microsoft Office 2010?

    You should contact the place where you bought the software where to find the product key.

    Concerning

  • When I try to connect to my wireless network, that it asks a security key how do I find the key my router is a comtrend CT-5363

    When I try to connect to my wireless network, that it asks a security key how do I find the key my router is a comtrend CT-5363

    Hello

    1. what operating system do you use?

    2 did you change on your computer?

    3. who is your internet service provider?

    If you use windows7, I suggest you to follow the steps from the links and check out.

    Set up a wireless router

    http://Windows.Microsoft.com/en-us/Windows7/set-up-a-wireless-router

    Network connection problems

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-network-connection-problems

    Set up a security key for a wireless network

    http://Windows.Microsoft.com/en-us/Windows7/set-up-a-security-key-for-a-wireless-network

  • I do not understand this step "we can assume any MAC address we want by finding the key that controls the NIC we want to change.

    Hello
    anyone ever did in Winxp with success. I do not understand this step

    «We can assume that any MAC address, we want by finding the key that controls the NIC we want change, put in a value chain called "NetworkAddress" and affecting the MAC address we want to use formatted as a hexadecimal 12-digit number (example: 000000000001).»

    It is a part of the "Windows 2000/XP/Vista: The Hard Way.

    from this link
    http://www.irongeek.com/i.php?page=security/changemac

    Concerning

    original title: change MAC address

    Hello

    I suggest to refer to this thread and follow the steps in this thread and check if that helps:

    http://social.technet.Microsoft.com/forums/en/w7itpronetworking/thread/697bf48c-A226-4315-8875-2bbeddf16db2

    The steps in this link are for Windows 7 and they are valid for Windows XP.

    It will be useful.

  • I can't find the key green screen in the menu effects in Adobe Premiere elements 12

    Is there anyone who can help me we can find the key to the green screen in first item 12. According to tutorial video on You Tube, there must be a touch of green screen in the menu overlay effects, but with me, it doesn't seem to be there.

    jajajoja

    Work with Premiere elements 12 Windows or Mac?

    If the Mac is not Chroma Key, key blue or green screen.

    If Windows... it must be in the workspace Expert to find and use the effects of inlay,

    as the Green overlay.

    Please consult the bulletin and consider and then let us know the result.

    Thank you.

    RTA

    Add on... You have installed the update 12.1 for 12? If this isn't the case, please do so using Help Menu/implementation of an open project.

    One of the fixes will be for the issue of the Expert workspace text Style.

  • Size of the data in a table and the size of the table

    I am trying to determine the size of the data in a table and also the overall table size. I use the following query:

    SELECT BOTTOM (a.owner) as owner,
    LOWER (a.table_name) AS table_name,
    a.tablespace_name,
    a.Num_Rows,
    ROUND ((a.blocks * 8 / 1024)) AS size_mb,
    a.Blocks,
    a.Blocks * 8 Blocks_Kilo_Byte.
    a.PCT_FREE,
    a.compression,
    a.Logging,
    b.bytes / 1024 / 1024
    From all_tables a, dba_segments b
    WHERE the a.owner AS SUPERIOR ("USER_TEST")
    AND a.table_name = "X_TEST_TABLE."
    AND b.segment_name = a.table_name
    AND b.owner = a.owner
    ORDER BY 1, 2;

    Is this the right way to go about finding the size of the data in a table? If this isn't the case, please give your suggestions.

    BTW, this in a 10g version.

    You probably want to use the DBMS_SPACE package. In particular, the procedures SPACE_USAGE and UNUSED_SPACE to get an accurate account of the use of space in a table. Your application may give you a relatively accurate estimate if the optimizer on your table's statistics are reasonably accurate estimates. But there is no guarantee that the optimizer statistics are accurate.

    If you want just an approximate answer and you're comfortable that your statistics are accurate, this query may be close enough. If you want a specific response, however, use the DBMS_SPACE package.

    Justin

  • When I opened my project and it is unable to locate the files. I find the files that are 'missing' and open the project.

    Hi im quite new for first pro and I'm having a problem when I opened my project and it is unable to locate the files. I find the files that are 'missing' and open the project. Everytime I open the project everything I see is all that media have these red, pink, blue, green, yellow lines, where pictures should be. And there is also the title of my pictures in the upper left corner. No one knows what it is and how I could fix this?

    [title published by mod]

    [Please do not double post, deleted the other]

    Right-click on the images in the project window: recharge or replace it.

  • What is the difference between a table and a subform?

    What is the difference between a table and a subform in LC forms? Please post your answers about the merits and demerits of using subforms instead of tables.

    Hello

    a table is simply a set of subforms with a particular role.

    It is easier to handle the tables if they must be dynamic (add or remove lines, show or hide lines when page breaks appear etc..).

    And Designers UI has some dialogue prepared in the object palette to simplify the settings of the tables.

    For subforms, dialog boxes are more frequent, so you have yourself a little more script.

    But at least you can do everything with subforms as you can do with tables.

    The only one who is not very good with tables we work when you wrap arrays in other tables.

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    

Maybe you are looking for