3

I have Oracle query:

SELECT index_name, table_name FROM user_indexes;

Since user_indexes is Oracle-specific view, how can I translate it to MySQL? This is my try:

DECLARE currrentDB      VARCHAR(64);
SELECT DATABASE() INTO currrentDB;
SELECT  INDEX_NAME, TABLE_NAME FROM information_schema.statistics s
        WHERE UPPER(s.TABLE_SCHEMA) = UPPER(currrentDB);

Are these two SQL statements are equivalent?

Benas
  • 2,106
  • 2
  • 39
  • 66
  • see this [answer](http://stackoverflow.com/questions/5213339/how-to-see-indexes-for-a-database-or-table) – Praveen Jul 23 '15 at 07:38

1 Answers1

1

In Oracle user_indexes view contains informations about the indexes stored in the schema of the currently connected user.

As in Mysql SCHEMA=DB, the select proposed by you can be considered equivalent to the select from Oracle's user_indexes view. Regards Giova

Giova
  • 1,137
  • 1
  • 9
  • 17