Untuk mengira jumlah bilangan jadual, gunakan konsep count(*) table_schema. Pertama, untuk menyemak jumlah jadual yang ada dalam "perniagaan" pangkalan data kami, kami perlu menggunakan arahan "tunjukkan".
mysql> show tables;
Berikut ialah output yang menunjukkan semua jadual dalam pangkalan data "perniagaan".
+--------------------------+ | 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)
Perniagaan pangkalan data kami mempunyai 132 jadual di atas.
Bilangan senarai semak.
mysql> SELECT count(*) AS TOTALNUMBEROFTABLES -> FROM INFORMATION_SCHEMA.TABLES -> WHERE TABLE_SCHEMA = 'business';
Output berikut memberikan kiraan semua jadual.
+---------------------+ | TOTALNUMBEROFTABLES | +---------------------+ | 132 | +---------------------+ 1 row in set (0.01 sec)
Atas ialah kandungan terperinci Bagaimana untuk mengira bilangan jadual dalam pangkalan data MySQL?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!