Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2015 August Find Table Dependency in MySQL

Find Table Dependency in MySQL

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

In this post, I am sharing different scripts to find table dependency for Foreign Key
Constraint, View and Stored Procedure of MySQL.

Database Architecture or Database Developer has to find table dependency before any DDL changes on the Tables.

Below are three different scripts:

1
2
3
4
5
6
7
8
9
10
/*Find Table Dependency in Foreign Key Constraint.*/
SELECT
Constraint_Type
,Constraint_Name
,Table_Schema
,Table_Name
FROM information_schema.table_constraints
WHERE Constraint_Type = 'FOREIGN KEY'
AND Table_Name = 'Any_Table'
AND Table_Schema ='db_Name';

1
2
3
4
5
/*Find Table Dependency in Views.*/
SELECT *
FROM information_schema.views
WHERE Table_Schema='db_name'
AND Table_Name = 'table_name'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*Find Table Dependency in Stored Procedure.*/
SELECT
Table_Schema
,Table_Name
,Table_Type
,Engine
,Routine_Name
,Routine_Schema
,Routine_Type
FROM information_schema.tables
INNER JOIN information_schema.routines
ON routines.routine_definition
LIKE Concat('%', tables.table_name, '%')
WHERE Table_Schema ='db_name'

Aug 15, 2015Anvesh Patel

Please visit other related articles...

  • MySQL: Simplest way to move your InnoDB table from one Database to another Database
  • MySQL: InnoDB Table Compression, How we can Compressed Table?
  • MySQL: Script to find Long Running Queries and Transactions
  • MySQL: The ARCHIVE Storage Engine, store large amounts of unindexed DATA
  • MySQL: CSV Storage Engine, Store Table data into CSV File
  • MySQL 5.5: How to configure and enable Performance Schema Engine?
  • MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data
  • MySQL: How Query Optimizer Read and Update the Index Statistics
Find any text into Stored Procedure and Function of MySQLrow_number and partition by in Mysql
Anvesh Patel

Database Engineer

August 15, 2015 MySQL, MySQL DBA Script, ScriptAnvesh Patel, database, database research and development, MySQL, MySQL Command, MySQL Database Administrator, MySQL Database Designing, MySQL Database Programming, MySQL Error, MySQL Performance Tunning, MySQL Query, MySQL Tips and Tricks, Object Dependency
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....