要計(jì)算表的總數(shù),請(qǐng)使用 table_schema 的 count(*) 概念。首先,要檢查我們的數(shù)據(jù)庫(kù)“business”中有多少?gòu)埍恚覀冃枰褂谩皊how”命令。
mysql> show tables;
登錄后復(fù)制
以下是顯示數(shù)據(jù)庫(kù)“business”中所有表的輸出。
+--------------------------+ | Tables_in_business | +--------------------------+ | addcheckconstraintdemo | | addcolumntable | | addconstraintdemo | | addnotnulldemo | | alphademo | | autoincrement | | autoincrementtable | | backticksymbol | | bookindexes | | chardemo | | checkdemo | | clonestudent | | columnexistdemo | | columnvaluenulldemo | | commaseperatedemo | | currentdatetime | | dateadddemo | | deletedemo | | deleterecord | | demo | | demo1 | | demoascii | | demoauto | | demobcrypt | | demoemptyandnull | | demoint | | demoonreplace | | demoschema | | demowhere | | distcountdemo | | distinctdemo | | distinctdemo1 | | duplicatebookindexes | | duplicatefound | | employeerecords | | employeetable | | escapedeom | | existsrowdemo | | findandreplacedemo | | firsttable | | foreigntable | | foreigntabledemo | | functionindexdemo | | functiontriggersdemo | | groupconcatenatedemo | | groupdemo | | groupdemo1 | | groupt_concatdemo | | ifelsedemo | | imagedemo | | incasesensdemo | | indexingdemo | | int1demo | | intdemo | | keydemo | | latandlangdemo | | limitoffsetdemo | | milliseconddemo | | modifycolumnnamedemo | | modifydatatype | | moneydemo | | moviecollection | | multipleindexdemo | | multiplerecordwithvalues | | myisamtoinnodbdemo | | mytable | | mytable1 | | newstudent | | nextpreviousdemo | | nonasciidemo | | nthrecorddemo | | nulldemo | | nullwithselect | | numbercolumndemo | | ondemo | | originaltable | | pasthistory | | presenthistory | | primarytable | | primarytable1 | | primarytabledemo | | qutesdemo | | rowcountdemo | | rownumberdemo | | rowstranspose | | rowstransposedemo | | saveintotextfile | | saveoutputintext | | secondtable | | sequencedemo | | singlequotesdemo | | smallintdemo | | sortingvarchardemo | | sourcetable | | spacecolumn | | student | | studentrecordwithmyisam | | studenttable | | table1 | | table2 | | tabledemo | | tbldemotrail | | tblf | | tblfirst | | tblfunctiontrigger | | tblifdemo | | tblp | | tblselectdemo | | tblstudent | | tbluni | | tblupdatelimit | | textdemo | | texturl | | timestampdemo | | trailingandleadingdemo | | transcationdemo | | triggedemo | | trigger1 | | trigger2demo | | trimdemo | | trimdemo2 | | uniqueconstdemo | | uniquedemo | | unsigneddemo | | updtable | | usernameandpassworddemo | | varchardemo | | varchardemo1 | | varchardemo2 | | varcharurl | | whereconditon | | xmldemo | +--------------------------+ 132 rows in set (0.01 sec)
登錄后復(fù)制
上面我們數(shù)據(jù)庫(kù)業(yè)務(wù)有132張表。
檢查表的數(shù)量。
mysql> SELECT count(*) AS TOTALNUMBEROFTABLES -> FROM INFORMATION_SCHEMA.TABLES -> WHERE TABLE_SCHEMA = 'business';
登錄后復(fù)制
以下輸出給出了所有表的計(jì)數(shù)。
+---------------------+ | TOTALNUMBEROFTABLES | +---------------------+ | 132 | +---------------------+ 1 row in set (0.01 sec)
登錄后復(fù)制
以上就是如何統(tǒng)計(jì)MySQL數(shù)據(jù)庫(kù)中表的數(shù)量?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!