Alle Tabellen anzeigen. Beschreibungsähnliche Funktionalität

Wie kann ich alle Tabellen in einer Datenbank anzeigen, die der Ausgabe von @ ähnelDESCRIBE myTable. Funktionalität hinzufügen für:

Alle Tische auf einmalTischgrößCharacter Set and Collation informationSort Capabilities

Hinweis:DESCRIBEie Ausgabe von @ ist einfach und erfolgt jeweils für eine einzelne Tabelle.

Bearbeiten

Nettes Feedback von Rick James. Ich war ratlos und brauchte dieses Brainstorming.

Wenn jemand Funktionen (zu meiner Selbstantwort) hinzufügen möchte, z. B. eine eingerückte Zeile am Ende jeder Tabelle für

Indexes (möglicherweise 1 Zeile pro Index, in der der Name und die Spaltennamen durch ein Komma getrennt angezeigt werden.Cardinality in dieser Indexzeile überForeign Key ConstraintsAlle anderen Waffen, die Ihre Kollegen erreichen, könnten nützlich seinHaben Sie diesen ganzen Block konzeptionell "Extended Info" genannt und einen Schalter (einen Parameter) für Yay oder Nay, um ihn zu erzeugen. Wenn 'N', dann produziere es nicht.

ch würde mich sehr freuen. Natürlich würde diese Information nicht unter den Spaltenüberschriften hängen, die ich bereits in der Selbstantwort unten gezeigt habe. So fällt einem sofort ein visuelles Element wie ein Einzug ein, das nicht genau Teil der Tabelle ist. Grobe Ausgabe ist in Ordnung.

Betrachten Sie Folgendes als grobe Hinweise, die hilfreich sein können:

create schema x99;
use x99;

create table parent
(   -- assume your have only one parent, ok bad example, it's early
    id int auto_increment primary key,
    fullName varchar(100) not null
)ENGINE=InnoDB;

-- drop table child;
create table child
(   id int auto_increment primary key,
    fullName varchar(100) not null,
    myParent int not null,
    CONSTRAINT `mommy_daddy` FOREIGN KEY (myParent) REFERENCES parent(id)
        ON DELETE CASCADE ON UPDATE CASCADE     
)ENGINE=InnoDB;

create table t3
(   id INT AUTO_INCREMENT PRIMARY KEY,
    myD DATE NOT NULL,
    myI INT NOT NULL,
    KEY `t3_001` (myD,myI)
);

create table t4
(   someCode CHAR(4) PRIMARY KEY,
    codeDescr VARCHAR(500) NOT NULL
);

create table t5
(   id INT AUTO_INCREMENT PRIMARY KEY,
    theCode CHAR(4) NOT NULL,
    d1 DATE NOT NULL,
    i1 INT NOT NULL,
    someOther DATETIME NOT NULL,
    FOREIGN KEY `cd_2_t4` (theCode) REFERENCES t4(someCode),
    FOREIGN KEY `cd_2_t3` (d1,i1) REFERENCES t3(myD,myI)
);

-- The below 2 lines are merely to show cardinality which I am sure is
-- read from INFO SCHEMA too
show indexes in child; -- to pick up cardinality (or from INFO SCHEMA)
show indexes in t5; -- ditto
-- So, I am not suggesting to actually call "show indexes"


-- http://dev.mysql.com/doc/refman/5.7/en/key-column-usage-table.html
-- James Goatcher
SELECT CONCAT( table_name, '.', 
column_name, ' -> ', 
referenced_table_name, '.', 
referenced_column_name ) AS list_of_fks 
FROM information_schema.KEY_COLUMN_USAGE 
WHERE REFERENCED_TABLE_SCHEMA = 'x99' 
AND REFERENCED_TABLE_NAME is not null 
ORDER BY TABLE_NAME, COLUMN_NAME; 
+-----------------------------+
| list_of_fks                 |
+-----------------------------+
| child.myParent -> parent.id |
| t5.d1 -> t3.myD             |
| t5.i1 -> t3.myI             |
| t5.theCode -> t4.someCode   |
+-----------------------------+

Despite the output suggested by James Goatcher on that Webpage, 
perhaps what would look better under table t5 as 2 lines:

t5.d1,i1 -> t3.myD,myI              <----- That there would be swell
t5.theCode -> t4.someCode

-- You may make the assumption that all tables are in the same schema
-- If they aren't and it blows up that is fine

drop schema x99;

Ich möchte diese Prämie vergeben.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage