MySQL有“这个”数据库的概念吗?

时间:2022-09-27 12:03:59

When writing a query, can I reference the current database's name, sort of like with the this keyword in Java? I am writing a script that I will run against several similar databases, and I need to query the information_schema.KEY_COLUMN_USAGE table with the CONSTRAINT_SCHEMA column in my WHERE clause.

在编写查询时,我是否可以引用当前数据库的名称,类似于Java中的this关键字?我正在编写一个脚本,将针对几个类似的数据库运行它,我需要查询information_schema。KEY_COLUMN_USAGE表,包含WHERE子句中的CONSTRAINT_SCHEMA列。

1 个解决方案

#1


3  

SELECT DATABASE() gives you the selected database http://dev.mysql.com/doc/refman/5.0/en/creating-database.html

SELECT DATABASE()为您提供所选的数据库http://dev.mysql.com/doc/refman/5.0/en/creating-database.html

#1


3  

SELECT DATABASE() gives you the selected database http://dev.mysql.com/doc/refman/5.0/en/creating-database.html

SELECT DATABASE()为您提供所选的数据库http://dev.mysql.com/doc/refman/5.0/en/creating-database.html