打开mysql
官方文档:Information Functions
可以看到mysql
查询库表信息的函数
Name | Description |
---|---|
BENCHMARK() | Repeatedly execute an expression |
CHARSET() | Return the character set of the argument |
COERCIBILITY() | Return the collation coercibility value of the string argument |
COLLATION() | Return the collation of the string argument |
CONNECTION_ID() | Return the connection ID (thread ID) for the connection |
CURRENT_ROLE() | Return the current active roles |
CURRENT_USER(), CURRENT_USER | The authenticated user name and host name |
DATABASE() | Return the default (current) database name |
FOUND_ROWS() | For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause |
ICU_VERSION() | ICU library version |
LAST_INSERT_ID() | Value of the AUTOINCREMENT column for the last INSERT |
ROLES_GRAPHML() | Return a GraphML document representing memory role subgraphs |
ROW_COUNT() | The number of rows updated |
SCHEMA() | Synonym for DATABASE() |
SESSION_USER() | Synonym for USER() |
SYSTEM_USER() | Synonym for USER() |
USER() | The user name and host name provided by the client |
VERSION() | Return a string that indicates the MySQL server version |
除了USER
、VERSION
、LAST_INSERT_ID
以外等常用函数还有DATABASE
这个可以用于获取当前USE
的数据库
例如获取当前数据库中的所有表,sql
如下:
select * from information_schema.tables where table_schema = (select database());
这些函数常用的场景如代码生成器和数据库备份维护应用等
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有