Niel de Wet
Niel de Wet

Reputation: 8408

Does MySQL have the concept of "this" database?

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.

Upvotes: 3

Views: 54

Answers (1)

AllisonC
AllisonC

Reputation: 3100

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

Upvotes: 3

Related Questions