MySQL

MySQL: Script to Create a Calendar

Posted on

Copied and tweaked from Github https://gist.github.com/bryhal/4129042 DROP TABLE IF EXISTS time_dimension; CREATE TABLE time_dimension ( id INTEGER PRIMARY KEY, — year*10000+month*100+day db_date DATE NOT NULL, year INTEGER NOT NULL, month INTEGER NOT NULL, — 1 to 12 day INTEGER NOT NULL, — 1 to 31 quarter INTEGER NOT NULL, — 1 to 4 week INTEGER […]

MySQL

MySQL: Table size query

Posted on

    SELECT TABLE_NAME, table_rows, data_length, index_length, ROUND(((data_length + index_length) / 1024 / 1024),2) ‘Size in MB’ FROM information_schema.TABLES WHERE table_schema = ‘mallagroup_mautic’ ORDER BY ROUND(((data_length + index_length) / 1024 / 1024),2) DESC ;