Skip to content

Instantly share code, notes, and snippets.

@nishitpatel
Last active December 28, 2015 11:55
Show Gist options
  • Save nishitpatel/b3043e2cf29bb44f2288 to your computer and use it in GitHub Desktop.
Save nishitpatel/b3043e2cf29bb44f2288 to your computer and use it in GitHub Desktop.
MySql Commands.
Command 1: Display all foriegn key constraint related to table
Query: select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where REFERENCED_TABLE_NAME = 'outlets'
Command 2: Drop Foriegn Key Constraint related to table
Query: ALTER TABLE 'Table Name' DROP FOREIGN KEY 'Foriegn Key Name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment