Monday, 2 July 2012

SQL of the day


SELECT
  TABLE_SCHEMA                                    AS "Data Base Name",
  SUM( DATA_LENGTH + INDEX_LENGTH ) / 1024 / 1024 AS "Data Base Size in MB"
FROM
  information_schema.TABLES
WHERE
  TABLE_SCHEMA IN
(
  SELECT
    SCHEMA_NAME
  FROM
    information_schema.SCHEMATA
  WHERE
    SCHEMA_NAME LIKE '%variation%'
)
GROUP BY
  table_schema
;