SHOW:
|
|
- or go back to the newest paste.
| 1 | DELIMITER // | |
| 2 | CREATE PROCEDURE country_hos | |
| 3 | (IN requested_column_name CHAR(20), IN requested_referenced_table_name CHAR(20)) | |
| 4 | BEGIN | |
| 5 | select distinct table_name | |
| 6 | from information_schema.columns | |
| 7 | where ( | |
| 8 | table_schema = 'usa' | |
| 9 | and column_name = requested_column_name | |
| 10 | and table_name not in (SELECT table_name FROM information_schema.key_column_usage WHERE referenced_table_name = requested_referenced_table_name AND table_schema = 'usa') | |
| 11 | and table_name not in (select table_name from information_schema.tables where table_rows = 0 and table_schema = 'usa')) | |
| 12 | END // | |
| 13 | DELIMITER ; |