登录
首页 >  数据库 >  MySQL

获取特定 MySQL 数据库中的非空表列表?

来源:tutorialspoint

时间:2023-09-06 19:47:53 253浏览 收藏

积累知识,胜过积蓄金银!毕竟在数据库开发的过程中,会遇到各种各样的问题,往往都是一些细节知识点还没有掌握好而导致的,因此基础知识点的积累是很重要的。下面本文《获取特定 MySQL 数据库中的非空表列表?》,就带大家讲解一下知识点,若是你对本文感兴趣,或者是想搞懂其中某个知识点,就请你继续往下看吧~

要获取特定 MySQL 数据库中的非空表列表,语法如下 -

SELECT table_type,table_name, table_schema from information_schema.tables
where table_rows >= 1 and table_schema = 'yourDatabaseName';

为您的数据库实现上述语法。这里,我们的数据库是“test”。查询如下 -

mysql> select table_type,table_name ,table_schema from information_schema.tables
−> where table_rows >= 1 and table_schema = 'test';

以下是显示数据库“test”中非空表的输出 -

+------------+------------------------------+--------------+
| TABLE_TYPE | TABLE_NAME                   | TABLE_SCHEMA |
+------------+------------------------------+--------------+
| BASE TABLE | add30minutesdemo             | test         |
| BASE TABLE | addoneday                    | test         |
| BASE TABLE | agecalculatesdemo            | test         |
| BASE TABLE | aliasdemo                    | test         |
| BASE TABLE | allcharacterbeforespace      | test         |
| BASE TABLE | allownulldemo                | test         |
| BASE TABLE | autoincrementdemo            | test         |
| BASE TABLE | betweendatedemo              | test         |
| BASE TABLE | bookdatedemo                 | test         |
| BASE TABLE | changecolumnpositiondemo     | test         |
| BASE TABLE | concatenatetwocolumnsdemo    | test         |
| BASE TABLE | cumulativesumdemo            | test         |
| BASE TABLE | currentdatetimedemo          | test         |
| BASE TABLE | dateasstringdemo             | test         |
| BASE TABLE | dateformatdemo               | test         |
| BASE TABLE | dateinsertdemo               | test         |
| BASE TABLE | datesofoneweek               | test         |
| BASE TABLE | datetimedemo                 | test         |
| BASE TABLE | dayofweekdemo                | test         |
| BASE TABLE | decimaltointdemo             | test         |
| BASE TABLE | defaultdemo                  | test         |
| BASE TABLE | deletemanyrows               | test         |
| BASE TABLE | differencetimestamp          | test         |
| BASE TABLE | distinctdemo                 | test         |
| BASE TABLE | employee                     | test         |
| BASE TABLE | employeedesignation          | test         |
| BASE TABLE | findlowercasevalue           | test         |
| BASE TABLE | generatingnumbersdemo        | test         |
| BASE TABLE | gmailsignin                  | test         |
| BASE TABLE | groupbytwofieldsdemo         | test         |
| BASE TABLE | groupmonthandyeardemo        | test         |
| BASE TABLE | highestnumberdemo            | test         |
| BASE TABLE | ifnulldemo                   | test         |
| BASE TABLE | insertignoredemo             | test         |
| BASE TABLE | insertwithmultipleandsigle   | test         |
| BASE TABLE | int11demo                    | test         |
| BASE TABLE | intvsintanythingdemo         | test         |
| BASE TABLE | lasttwocharacters            | test         |
| BASE TABLE | likebinarydemo               | test         |
| BASE TABLE | likedemo                     | test         |
| BASE TABLE | maxlengthfunctiondemo        | test         |
| BASE TABLE | newtableduplicate            | test         |
| BASE TABLE | notequalsdemo                | test         |
| BASE TABLE | nowandcurdatedemo            | test         |
| BASE TABLE | nthrecorddemo                | test         |
| BASE TABLE | nullandemptydemo             | test         |
| BASE TABLE | orderbycharacterlength       | test         |
| BASE TABLE | orderbynullfirstdemo         | test         |
| BASE TABLE | orderindemo                  | test         |
| BASE TABLE | originaltable                | test         |
| BASE TABLE | parsedatedemo                | test         |
| BASE TABLE | passinganarraydemo           | test         |
| BASE TABLE | prependstringoncolumnname    | test         |
| BASE TABLE | pricedemo                    | test         |
| BASE TABLE | queryresultdemo              | test         |
| BASE TABLE | replacedemo                  | test         |
| BASE TABLE | rowexistdemo                 | test         |
| BASE TABLE | rowpositiondemo              | test         |
| BASE TABLE | rowwithsamevalue             | test         |
| BASE TABLE | safedeletedemo               | test         |
| BASE TABLE | searchtextdemo               | test         |
| BASE TABLE | selectdataonyearandmonthdemo | test         |
| BASE TABLE | selectdistincttwocolumns     | test         |
| BASE TABLE | skiplasttenrecords           | test         |
| BASE TABLE | stringreplacedemo            | test         |
| BASE TABLE | stringtodate                 | test         |
| BASE TABLE | student                      | test         |
| BASE TABLE | studentdemo                  | test         |
| BASE TABLE | studentmodifytabledemo       | test         |
| BASE TABLE | studenttable                 | test         |
| BASE TABLE | subtract3hours               | test         |
| BASE TABLE | temporarycolumnwithvaluedemo | test         |
| BASE TABLE | timetosecond                 | test         |
| BASE TABLE | timetoseconddemo             | test         |
| BASE TABLE | toggledemo                   | test         |
| BASE TABLE | toogledemo                   | test         |
| BASE TABLE | updatevalueincrementally     | test         |
| BASE TABLE | wheredemo                    | test         |
| BASE TABLE | wholewordmatchdemo           | test         |
| BASE TABLE | zipcodepadwithzerodemo  
+------------+------------------------------+--------------+
80 rows in set (0.00 sec)

好了,本文到此结束,带大家了解了《获取特定 MySQL 数据库中的非空表列表?》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多数据库知识!

声明:本文转载于:tutorialspoint 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>