{"id":5346,"date":"2024-10-30T06:40:33","date_gmt":"2024-10-30T06:40:33","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=5346"},"modified":"2024-10-30T06:40:36","modified_gmt":"2024-10-30T06:40:36","slug":"how-to-see-foreign-keys-related-to-table-or-column","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/","title":{"rendered":"How to See Foreign Keys Related to Table or Column"},"content":{"rendered":"\n<p>MySQL is a popular relational database used by many organizations. The relations in a database are commonly established using foreign keys. Foreign keys are one or more columns that reference another table. Database programmers and administrators often need to find out which foreign keys point to a given table or column. In this article, we will learn how to get foreign keys related to table or column.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#What_is_Foreign_Key\" >What is Foreign Key<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#Why_you_need_to_see_foreign_keys_related_to_table\" >Why you need to see foreign keys related to table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#How_to_See_Foreign_Keys_Related_to_Table_or_Column\" >How to See Foreign Keys Related to Table or Column<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#1_Foreign_Keys_to_Table\" >1. Foreign Keys to Table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#2_Foreign_Key_to_Column\" >2. Foreign Key to Column<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Foreign_Key\"><\/span>What is Foreign Key<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Foreign key is a collection of one or more columns from one table that reference columns from another table. The table with foreign key is the child table and the referenced table is the parent table. It creates a referential integrity between two tables. In the absence of foreign keys, it would be really difficult to understand how the data in two tables are related.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_you_need_to_see_foreign_keys_related_to_table\"><\/span>Why you need to see foreign keys related to table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before you create a foreign key to a table it is important to find out if there are already any foreign keys pointing to it. This will help you avoid duplicate or redundant keys. It will also help you understand other foreign key constraints that are already applicable to your table, before you add a new foreign key to it. This is important especially when you delete rows from the table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_See_Foreign_Keys_Related_to_Table_or_Column\"><\/span>How to See Foreign Keys Related to Table or Column<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are several ways to get a list of foreign keys related table or column in MySQL. Let us say you have two tables orders and products, with the products table containing a foreign key pointing to orders table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">create table products(<br>  id int,<br>  product_name varchar(255),<br>  primary key (id)  <br>);<br><br>create table orders (<br>    order_id int,<br>    product_id int,<br>    order_date date,<br>    primary key (order_id),<br>    foreign key (product_id) references products(id)<br>);<\/pre>\n\n\n\n<p>Please ensure that products table is created before orders table, since orders table contains a foreign key pointing to products table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Foreign_Keys_to_Table\"><\/span>1. Foreign Keys to Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>MySQL and SQL Server database contain information_schema database that contains meta information about all databases and tables in the server. You can use the following query to get a list of foreign keys pointing to a table. Replace &lt;table_name> with the name of the table for which you want to determine the list of foreign keys.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT \n  TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME\nFROM\n  INFORMATION_SCHEMA.KEY_COLUMN_USAGE\nWHERE\n  REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND\n  REFERENCED_TABLE_NAME = '<strong>&lt;table_name><\/strong>' \\G<\/code><\/pre>\n\n\n\n<p>For example, here is the query to get foreign keys to products table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql> SELECT<br>       TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME<br>       FROM<br>       INFORMATION_SCHEMA.KEY_COLUMN_USAGE<br>       WHERE<br>       REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND<br>       REFERENCED_TABLE_NAME = '<strong>products<\/strong>' \\G<br>*************************** 1. row ***************************<br>            TABLE_NAME: orders<br>           COLUMN_NAME: product_id<br>       CONSTRAINT_NAME: orders_ibfk_1<br> REFERENCED_TABLE_NAME: products<br>REFERENCED_COLUMN_NAME: id<\/pre>\n\n\n\n<p>The above result displays the table referencing products (that is, orders), its foreign key column name, constraint_name and the referenced parent table products.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Foreign_Key_to_Column\"><\/span>2. Foreign Key to Column<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you want to view the foreign keys pointing to a column of your table, you can modify the above query as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT <br>  TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME<br>FROM<br>  INFORMATION_SCHEMA.KEY_COLUMN_USAGE<br>WHERE<br>  REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND<br>  REFERENCED_TABLE_NAME = '<strong>&lt;table_name><\/strong>' AND<br>  REFERENCED_COLUMN_NAME = '<strong>&lt;column_name><\/strong>' \\G<\/pre>\n\n\n\n<p>Here is a query to get foreign keys pointing to ID column of products table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql>   SELECT<br>       TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME<br>       FROM<br>       INFORMATION_SCHEMA.KEY_COLUMN_USAGE<br>       WHERE<br>       REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND<br>       REFERENCED_TABLE_NAME = '<strong>products<\/strong>' AND<br>       REFERENCED_COLUMN_NAME = '<strong>id<\/strong>' \\G<br>*************************** 1. row ***************************<br>            TABLE_NAME: orders<br>           COLUMN_NAME: product_id<br>       CONSTRAINT_NAME: orders_ibfk_1<br> REFERENCED_TABLE_NAME: products<br>REFERENCED_COLUMN_NAME: id<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt how to see foreign keys pointing to table or column. You can use any of these methods depending on your requirement. It is important to keep an eye on foreign keys referencing your table or column to avoid creating duplicate constraints and also for considering them at the time of deletion.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\">How to Reset Auto Increment in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-list-users-in-mysql\/\">How to List Users in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-character-set-of-mysql-database-or-table-or-column\/\">How to Get Character Set of MySQL Database<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table in MySQL.<\/p>\n","protected":false},"author":1,"featured_media":5362,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324],"tags":[329],"class_list":["post-5346","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-foreign-keys"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to See Foreign Keys Related to Table or Column - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to See Foreign Keys Related to Table or Column - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-30T06:40:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-30T06:40:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"277\" \/>\n\t<meta property=\"og:image:height\" content=\"185\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to See Foreign Keys Related to Table or Column\",\"datePublished\":\"2024-10-30T06:40:33+00:00\",\"dateModified\":\"2024-10-30T06:40:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/\"},\"wordCount\":521,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1\",\"keywords\":[\"foreign keys\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/\",\"name\":\"How to See Foreign Keys Related to Table or Column - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1\",\"datePublished\":\"2024-10-30T06:40:33+00:00\",\"dateModified\":\"2024-10-30T06:40:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1\",\"width\":277,\"height\":185,\"caption\":\"foreign keys related to table\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-see-foreign-keys-related-to-table-or-column\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to See Foreign Keys Related to Table or Column\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to See Foreign Keys Related to Table or Column - Ubiq BI","description":"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/","og_locale":"en_US","og_type":"article","og_title":"How to See Foreign Keys Related to Table or Column - Ubiq BI","og_description":"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2024-10-30T06:40:33+00:00","article_modified_time":"2024-10-30T06:40:36+00:00","og_image":[{"width":277,"height":185,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to See Foreign Keys Related to Table or Column","datePublished":"2024-10-30T06:40:33+00:00","dateModified":"2024-10-30T06:40:36+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/"},"wordCount":521,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1","keywords":["foreign keys"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/","name":"How to See Foreign Keys Related to Table or Column - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1","datePublished":"2024-10-30T06:40:33+00:00","dateModified":"2024-10-30T06:40:36+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Do you need to get list of foreign keys related to table or column in SQL? Here are the different ways to get foreign keys referencing table.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1","width":277,"height":185,"caption":"foreign keys related to table"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to See Foreign Keys Related to Table or Column"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/foreign-keys-database-table.jpg?fit=277%2C185&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1oe","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=5346"}],"version-history":[{"count":15,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5346\/revisions"}],"predecessor-version":[{"id":5361,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5346\/revisions\/5361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/5362"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=5346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=5346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=5346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}