前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql数据库信息函数

mysql数据库信息函数

作者头像
阿超
发布2022-08-21 11:29:21
1.7K0
发布2022-08-21 11:29:21
举报
文章被收录于专栏:快乐阿超快乐阿超

打开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

除了USERVERSIONLAST_INSERT_ID以外等常用函数还有DATABASE

这个可以用于获取当前USE的数据库

例如获取当前数据库中的所有表,sql如下:

代码语言:javascript
复制
select * from information_schema.tables where table_schema = (select database());

这些函数常用的场景如代码生成器和数据库备份维护应用等

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-02-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档