SELECT ( COUNT ( `DB_first_level` ) DIV ? ) * ? FROM ( SELECT DISTINCTROW `SUBSTRING_INDEX` ( SCHEMA_NAME , ?, ... ) `DB_first_level` FROM `INFORMATION_SCHEMA` . `SCHEMATA` WHERE `SCHEMA_NAME` < ? ) `t` 