Mysql:函数之一:information functions

Name Description
BENCHMARK(cont,expr) Repeatedly execute an expression主要是测试计算密集型的标量表达式——类似于压力测试。如果是查询,必须单行单列
CHARSET(str)(v4.1.0) Return the character set of the argument
COERCIBILITY(str)(v4.1.1) Return the collation coercibility value of the string argument
COLLATION(str)(v4.1.0) Return the collation of the string argument
CONNECTION_ID() Return the connection ID (thread ID) for the connection连接的会话或线程ID
CURRENT_USER(), CURRENT_USER Return the user name and host name combination从mysql服务器帐号管理中获得的对应当前会话用户的真实登录认证用户,两者可能不同。该函数是和特定的安全上下文相关的!如果sqlserver的current_user()——随调用的安全上下文变化可能和登录的user()、权限都不相同
DATABASE()、SCHEMA()(v5.0.2) Return the default (current) database name当前数据库,可能是null
FOUND_ROWS() For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause
select语句查询到符合条件的行数——该函数会忽略limit子句的影响
LAST_INSERT_ID() Value of the AUTOINCREMENT column for the last INSERT
ROW_COUNT()(v5.0.1) returns the number of rows updated, inserted, or deleted by the preceding statement. This is the same as the row count that the mysql client displays and the value from the mysql_affected_rows() C API function.和sqlserver的@@rowcount对应
USER()、SYSTEM_USER()、SESSION_USER() Return the current user name and host name是从真实的连接环境中获得的完全限定用户名,与真实的登录认证用户可能不同。
VERSION() Returns a string that indicates the MySQL server version
原文地址:https://www.cnblogs.com/jinzhenshui/p/1504078.html