查找所有表的语句
select table_name
from information_schema.tables
where table_schema='当前数据库'
mysql> use mysql
Database changed
mysql>show tables
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
28 rows in set (0.05 sec)
根据具体问题类型,进行步骤拆解/原因原理分析/内容拓展等。
具体步骤如下:/导致这种情况的原因主要是??
查找所有表的语句select table_name
from information_schema.tables
where table_schema='当前数据库'
mysql> use mysql
Database changed
mysql>show tables
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db|
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic|
| innodb_index_stats|
| innodb_table_stats|
| ndb_binlog_index |
| plugin|
| proc |
| procs_priv|
| proxies_priv |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name|
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
28 rows in set (0.05 sec)
show tables即为显示当前数据库中所有的表。
这个是显示“mysql”这个数据库中的所有的表,一共有28张。
用sql获取数据库中所有的表名的方法:1、oracle下:select
table_name
from
all_tables
2、MySQL下:select
table_name
from
information_schema.tables
where
table_schema='csdb'
and
table_type='base
table'
3、sql
server下:select
name
from
sys.tables
go
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)