- Here is a query which will list all tables with their corresponding column counts as output:
- SELECT table_name,count(*) FROM information_schema.columns WHERE table_name in (select distinct table_name from information_schema.tables where table_schema='MY_DATABASE_NAME') group by table_name;
Sample output:
+------------------+----------+
| table_name | count(*) |
+------------------+----------+
| arcCandCommLinks | 10 |
| arcCandMaster | 20 |
| arcCommMaster | 20 |
| arcCongLdrRoles | 9 |
| arcCongOthNames | 13 |
| arcCongress | 29 |
| arcCongTerms | 20 |
| arcIndiv | 26 |
| arcOth | 26 |
| CandCommLinks | 8 |
| CommInfo | 4 |
| CongLdrRoles | 7 |
| CongOthNames | 11 |
| Congress | 27 |
| CongTerms | 18 |
| Form1 | 108 |
| Form1S | 38 |
| Indiv | 24 |
| lkpAffRel | 3 |
| lkpCandidates | 3 |
| lkpCandStatus | 2 |
| lkpCommittees | 3 |
| lkpCommType | 2 |
| lkpDesignation | 2 |
| lkpElec | 2 |
| lkpEntTp | 3 |
| lkpExpCat | 3 |
| lkpF1CommTp | 2 |
| lkpFilingFreq | 2 |
| lkpFormTp | 2 |
| lkpIncChalStatus | 2 |
| lkpIntGrpCat | 2 |
| lkpLnNbr | 2 |
| lkpPACTp | 2 |
| lkpParties | 4 |
| lkpPartyTp | 3 |
| lkpRptPrd | 4 |
| lkpTable | 2 |
| lkpTransPurp | 5 |
| lkpTransTp | 3 |
| Oth | 24 |
| PACViews | 2 |
| PAS2 | 24 |
| People | 11 |
| RptHdrs_F3 | 102 |
| RptHdrs_F3L | 36 |
| RptHdrs_F3P | 215 |
| RptHdrs_F3X | 132 |
| SchA | 49 |
| SchB | 48 |
| SchC | 41 |
| SchC1 | 51 |
| SchC2 | 20 |
| SchD | 35 |
| SchE | 47 |
| SchF | 48 |
| SchH1 | 16 |
| SchH2 | 12 |
| SchH3 | 13 |
| SchH4 | 37 |
| SchH5 | 13 |
| SchH6 | 35 |
| SchI | 33 |
| SchL | 44 |
| SchText | 9 |
| stgCandidates | 21 |
| stgCommittees | 19 |
| stgIndiv | 29 |
| stgOth | 29 |
| stgPAS2 | 30 |
+------------------+----------+
70 rows in set (1.02 sec)
No comments:
Post a Comment