Problem with SQL: create temporary table if not exists chkdb_out( table_name varchar(50), field_name varchar(50), priority int, seq int, txt varchar(250) ) Error writing file '/tmp/#sql2fec_d28_0.frm' (Errcode: 28)

Problem with SQL: create table if not exists chkdb_tmp( str_val1 varchar(250), str_val2 varchar(250), int_val int, str_val3 varchar(250), str_val4 varchar(250) ) Error writing file './CheckMyPages/chkdb_tmp.frm' (Errcode: 28)

Problem with SQL: create table if not exists chkdb_tabs( table_name varchar(50), table_rows int ) select t.table_name, t.table_rows from information_schema.TABLES t where t.table_schema = schema() and t.table_name like 'chk_%' and t.table_name not like 'chkdb_%' and t.table_type = 'BASE TABLE' Error writing file './CheckMyPages/chkdb_tabs.frm' (Errcode: 28)

Problem with SQL: create table if not exists chkdb_fields( table_name varchar(50), column_name varchar(50), field_type varchar(30) ) select t.table_name, c.column_name, concat( replace(c.COLUMN_TYPE,'int(11)','int'), if( c.IS_NULLABLE='YES', ' NULL','' ) ) as field_type from information_schema.TABLES t, information_schema.COLUMNS c where t.table_schema = schema() and t.table_type = 'BASE TABLE' and t.table_name like 'chk_%' and t.table_name not like 'chkdb_%' and c.table_schema = schema() and c.table_name = t.table_name Got error 28 from storage engine

Problem with SQL: create table if not exists chkdb_idxs( table_name varchar(50), index_name varchar(50), non_unique boolean, seq_in_index int, field_name varchar(50), nullable varchar(3) ) select s.table_name, s.index_name, s.non_unique, s.seq_in_index, s.column_name as field_name, s.nullable from information_schema.TABLES t, information_schema.STATISTICS s where t.table_schema = schema() and t.table_type = 'BASE TABLE' and t.table_name like 'chk_%' and t.table_name not like 'chkdb_%' and s.table_schema = schema() and s.table_name = t.table_name Error writing file './CheckMyPages/chkdb_idxs.frm' (Errcode: 28)

Problem with SQL: insert chkdb_out select ' General', '', 20,0, 'There are no user tables in this database' from dual where ( select count(*) from chkdb_tabs ) = 0 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: select count(*) from chkdb_tabs where lower(table_name) like '%s'Table 'CheckMyPages.chkdb_tabs' doesn't exist

Problem with SQL: select count(*) from chkdb_tabs where lower(table_name) not like '%s'Table 'CheckMyPages.chkdb_tabs' doesn't exist

Problem with SQL: insert chkdb_out select t.table_name, '', 20,table_rows, concat( 'Table has ', table_rows, ' rows' ) from chkdb_tabs t where table_rows > 1000000 order by t.table_rows desc limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select t.table_name, '', 30,table_rows, 'This table is not referenced by your stored procedures' from chkdb_tabs t where 1 = 1 and not exists( select 1 from information_schema.ROUTINES r where r.ROUTINE_SCHEMA=schema() and ( ROUTINE_DEFINITION regexp concat('from *',t.table_name) or ROUTINE_DEFINITION regexp concat(', *',t.table_name) ) ) Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select t.table_name, '', 10,table_rows, 'This table has no indexes' from chkdb_tabs t where table_name not in ( SELECT table_name FROM chkdb_idxs ) order by table_rows desc limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name, '', 20,table_rows, 'This table has no unique index' from chkdb_tabs t where table_name not in ( select table_name from chkdb_idxs where non_unique=0 ) and t.table_name in ( select table_name from chkdb_idxs ) order by table_rows desc limit 10 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select t.table_name, '', 35,table_rows, 'This table has no primary key' from chkdb_tabs t where t.table_name not in ( select table_name from chkdb_idxs where index_name = 'PRIMARY' ) order by table_rows desc limit 10 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: select t.table_name from chkdb_tabs t where 1 = 1 and table_name not in ( select table_name from chkdb_idxs where non_unique = 0 ) and t.table_rows between 2 and 1000000 Table 'CheckMyPages.chkdb_tabs' doesn't exist

Problem with SQL: insert chkdb_out select ' General','', 40,0, concat( 'MySQL version ', version(), ' is no longer current' ) from dual where version() < '5' Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select i.table_name, '', 20,0, concat( 'The unique index ', i.index_name, ' contains the nullable columns (=col,', group_concat( i.field_name ), ')' ) from chkdb_tabs t, chkdb_idxs i where i.table_name = t.table_name and i.nullable = 'YES' and i.non_unique = 0 group by i.index_name, i.table_name limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select i.table_name, '', 80,0, concat( 'The index ', i.index_name, ' contains the nullable columns (=col,', group_concat( i.field_name ), ')' ) from chkdb_tabs t, chkdb_idxs i where i.table_name = t.table_name and i.nullable = 'YES' and i.non_unique = 1 group by i.index_name, i.table_name limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name,'', 20,0, concat( 'The indexes (=null,', group_concat( distinct s2.index_name ), ') cover the same fields' ) from chkdb_idxs s1, chkdb_idxs s2, chkdb_tabs t where s1.table_name = t.table_name and s2.table_name = s1.table_name and s2.index_name != s1.index_name and s1.seq_in_index = 2 and not exists( select 1 from chkdb_idxs s3 where s3.table_name = s2.table_name and s3.index_name = s2.index_name and s3.field_name not in ( select s4.field_name from chkdb_idxs s4 where s4.table_name = s1.table_name and s4.index_name = s1.index_name ) ) group by t.table_name limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t1.table_name, '', 40,t1.table_rows, concat( 'Different compound index order to table ', s2.table_name, '' ) from chkdb_idxs s1, chkdb_idxs s2, chkdb_tabs t1, chkdb_tabs t2 where t1.table_name != t2.table_name and s1.table_name = t1.table_name and s2.table_name = t2.table_name and s1.seq_in_index = 2 and s2.seq_in_index = 2 and not exists( select 1 from chkdb_idxs s3 where s3.table_name = s1.table_name and s3.index_name = s1.index_name and s3.field_name not in ( select s4.field_name from chkdb_idxs s4 where s4.table_name = s2.table_name and s4.index_name = s2.index_name ) ) and exists( select 1 from chkdb_idxs s3, chkdb_idxs s4 where s3.table_name = s1.table_name and s4.table_name = s2.table_name and s3.index_name = s1.index_name and s4.index_name = s2.index_name and s3.field_name = s4.field_name and s3.seq_in_index != s4.seq_in_index ) Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct table_name, '', 40,0, concat( 'This table has ', count(distinct index_name), ' indexes!' ) from chkdb_idxs group by table_name having count( distinct index_name ) > 3 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: delete from chkdb_tmpTable 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select c.column_name, c.field_type, count(*), null from chkdb_fields c group by c.column_name,c.field_type Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: update chkdb_tmp set str_val3 = ( select field_type from chkdb_fields c where c.column_name = chkdb_tmp.str_val1 group by c.field_type having count(*) > 4 order by count(*) desc limit 1 ) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct f.table_name, f.column_name, 20,0, concat( 'Column ',f.column_name, ' is defined as ', t.str_val2, ' while normally defined as ', t.str_val3, '' ) from chkdb_fields f, chkdb_tmp t where t.str_val2 != t.str_val3 and t.str_val3 > '' and t.str_val1 = f.column_name and f.field_type = t.str_val2 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select t.table_name, '', 30,table_rows, 'Is this table required?' from chkdb_tabs t where table_name like '%tmp%' or ( table_name like '%temp%' and table_name not like '%systemp%' ) or table_name like '%bak%' or table_name like '%backup%' or table_name like '%copy%' or table_name like '%old%' or table_name regexp '[0-9][0-9][0-9][0-9][0-9][0-9]' limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name, '', 40,t.table_rows, concat( 'Should the fields ' , '', c.column_name, '', ', ', '', c2.column_name, '', ' ... be moved into a separate table?' ) from chkdb_tabs t, chkdb_fields c, chkdb_fields c2 where c.table_name = t.table_name and ( c.column_name like '%1%' or c.column_name like '%jan%' ) and c2.table_name = t.table_name and c2.column_name != c.column_name and ( c2.column_name like '%2%' or c2.column_name like '%feb%' ) limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name, '', 40,count(*), concat( 'This table has a similar name to (=tab,', group_concat( distinct t.table_name ), ')' ) from chkdb_tabs t group by trim( trailing 's' from lower(replace( t.table_name,'_',''))) having count(distinct t.table_name) > 1 limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: delete from chkdb_tmpTable 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select trim( trailing 's' from lower(replace( c.column_name,'_',''))) as name, concat( 'Column names (=col,', group_concat( distinct c.column_name ), ') should perhaps be standardised' ), NULL,NULL from chkdb_fields c group by name having count(distinct c.column_name) > 1 limit 10Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct c.table_name, c.column_name, 50,0, t.str_val2 from chkdb_fields c, chkdb_tmp t where trim( trailing 's' from lower(replace( c.column_name,'_',''))) = t.str_val1 limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name, '', 70,0, 'the naming of this table is poor' from chkdb_tabs t where lower( t.table_name ) like 'tab_%' or lower( t.table_name ) like 'table_%' or lower( t.table_name ) like '%_table' or lower( t.table_name ) like '%_tab' limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: select concat( t.table_name, '=', group_concat( c.column_name ) ) from chkdb_tabs t, chkdb_fields c where c.table_name = t.table_name and c.field_type like '%datetime%' and t.table_rows > 0 group by t.table_name Table 'CheckMyPages.chkdb_tabs' doesn't exist

Problem with SQL: delete from chkdb_tmpTable 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select distinct table_name, NULL, NULL, 'Table' from chkdb_tabs Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,6 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,6 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,5 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,5 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,4 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,4 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,3 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,3 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,2 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,2 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct str_val1, '', 50,0, concat( 'Table names normally have the prefix (=null,', ( select concat( 'or,', group_concat( str_val1 ) ) from chkdb_tmp where str_val3 = 'prefix' ), ')' ) from chkdb_tmp t where str_val3 = 'Table' and not exists ( select 1 from chkdb_tmp t2 where t2.str_val3 = 'prefix' and t.str_val1 like concat( t2.str_val1,'%' ) ) Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: update chkdb_tmp set str_val2 = concat( 'initially ', if( binary str_val1 rlike '^[A-Z][A-Z]', 'uppercase', if ( binary str_val1 rlike '^[A-Z][a-z]%', 'capitalised', 'lowercase' ) ), if( binary str_val1 like '%\_%', ' with underscore', '' ), ' and then', if( binary str_val1 not rlike '[a-z]', ' uppercase', if ( binary str_val1 rlike '^...*[A-Z]', ' capitalised', ' lowercase' ) ) ) where str_val3 = 'Table' Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: select str_val2, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Table' ) as pct from chkdb_tmp where str_val3 = 'Table' group by str_val2 order by pct desc limit 1 Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct str_val1, '', 90,0, 'Table naming style is usually ' from chkdb_tmp where 0 > 50 and str_val2 != '' Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: delete from chkdb_tmpTable 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3, str_val4 ) select distinct column_name, NULL, NULL, 'Field', table_name from chkdb_fields Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,6 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,6 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,5 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,5 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,4 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,4 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,3 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,3 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,2 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,2 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct str_val4, '', 50,0, concat( 'Field ', str_val1, ' should have the prefix (=null,', ( select concat( 'or,', group_concat( str_val1 ) ) from chkdb_tmp where str_val3 = 'prefix' ), ')' ) from chkdb_tmp t where 1 = 0 and str_val3 = 'Field' and not exists ( select 1 from chkdb_tmp t2 where t2.str_val3 = 'prefix' and t.str_val1 like concat( t2.str_val1,'%' ) ) Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: update chkdb_tmp set str_val2 = concat( 'initially ', if( binary str_val1 rlike '^[A-Z][A-Z]', 'uppercase', if ( binary str_val1 rlike '^[A-Z][a-z]%', 'capitalised', 'lowercase' ) ), if( binary str_val1 like '%\_%', ' with underscore', '' ), ' and then', if( binary str_val1 not rlike '[a-z]', ' uppercase', if ( binary str_val1 rlike '^...*[A-Z]', ' capitalised', ' lowercase' ) ) ) where str_val3 = 'Field' Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: select str_val2, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Field' ) as pct from chkdb_tmp where str_val3 = 'Field' group by str_val2 order by pct desc limit 1 Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct ' General', '', 90,0, concat( 'Field ', str_val1, ' naming style is usually ' ) from chkdb_tmp where 1 = 0 Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: delete from chkdb_tmpTable 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select distinct routine_name, NULL, NULL, 'Stored procedure' from information_schema.ROUTINES where routine_schema = schema() and routine_name like 'chk_%' Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,6 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,6 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,5 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,5 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,4 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,4 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,3 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,3 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_tmp ( str_val1, str_val2, int_val, str_val3 ) select substr( str_val1,1,2 ) as fixing, NULL, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct, 'prefix' from chkdb_tmp where substr( str_val1,1,2 ) like '%\_' group by fixing having pct > 10 and count(*) > 5 and not exists ( select 1 from chkdb_tmp t where str_val3 = 'prefix' and t.str_val1 like concat( fixing,'%' )) Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct ' General', '', 70,0, concat( 'Stored procedure ', str_val1, ' does not have the prefix (=null,', ( select concat( 'or,', group_concat( str_val1 ) ) from chkdb_tmp where str_val3 = 'prefix' ), ')' ) from chkdb_tmp t where str_val3 = 'Stored procedure' and not exists ( select 1 from chkdb_tmp t2 where t2.str_val3 = 'prefix' and t.str_val1 like concat( t2.str_val1,'%' ) ) Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: update chkdb_tmp set str_val2 = concat( 'initially ', if( binary str_val1 rlike '^[A-Z][A-Z]', 'uppercase', if ( binary str_val1 rlike '^[A-Z][a-z]%', 'capitalised', 'lowercase' ) ), if( binary str_val1 like '%\_%', ' with underscore', '' ), ' and then', if( binary str_val1 not rlike '[a-z]', ' uppercase', if ( binary str_val1 rlike '^...*[A-Z]', ' capitalised', ' lowercase' ) ) ) where str_val3 = 'Stored procedure' Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: select str_val2, ( count(*) * 100 ) / ( select count(*) from chkdb_tmp where str_val3 = 'Stored procedure' ) as pct from chkdb_tmp where str_val3 = 'Stored procedure' group by str_val2 order by pct desc limit 1 Table 'CheckMyPages.chkdb_tmp' doesn't exist

Problem with SQL: insert chkdb_out select distinct ' General', '', 90,0, concat( 'Stored procedure ', str_val1, ' naming style is usually ' ) from chkdb_tmp where 0 > 50 and str_val2 != '' Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct ' General', '', 80,0, concat( 'Stored procedure ', routine_name, ' contains cursors' ) from information_schema.ROUTINES where routine_schema = schema() and routine_name like 'chk_%' and ROUTINE_DEFINITION regexp 'fetch *[a-zA-Z0-9]+ *into ' limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct ' General', '', 95,0, concat( 'Stored procedure ', routine_name, ' is recursive' ) from information_schema.ROUTINES where routine_schema = schema() and routine_name like 'chk_%' and ROUTINE_DEFINITION regexp concat( 'call *', routine_name ) limit 10Table 'CheckMyPages.chkdb_out' doesn't exist

Problem with SQL: insert chkdb_out select distinct t.table_name, '', 70,0, concat( 'Field ', c.column_name, ' could have a foreign key against table ', ( select s2.table_name from chkdb_tabs t2, chkdb_idxs s2 where s2.table_name = t2.table_name and s2.NON_UNIQUE = 0 and t2.table_name != t.table_name group by s2.table_name , s2.index_name having count(*) = 1 and group_concat(s2.field_name) = c.column_name limit 1 ), ' ( ', c.column_name, ' )' ) from chkdb_tabs t, chkdb_fields c where c.table_name = t.table_name and not exists( select 1 from chkdb_tabs t2, chkdb_idxs s2 where s2.table_name = t2.table_name and s2.NON_UNIQUE = 0 and t2.table_name = t.table_name group by s2.table_name , s2.index_name having count(*) = 1 and group_concat(s2.field_name) = c.column_name ) and exists( select 1 from chkdb_tabs t2, chkdb_idxs s2 where s2.table_name = t2.table_name and s2.NON_UNIQUE = 0 and t2.table_name != t.table_name group by s2.table_name , s2.index_name having count(*) = 1 and group_concat(s2.field_name) = c.column_name ) and not exists( select 1 from information_schema.KEY_COLUMN_USAGE k where k.table_name = t.table_name and k.column_name = c.column_name ) Table 'CheckMyPages.chkdb_out' doesn't exist
MySQL Database Analysis (0.2b)

Logout > Database CheckMyPages > Restricted to chk_ >
Problem with SQL: select count(*) from information_schema.ROUTINES where routine_schema = schema() and routine_name like 'chk_%' Got error 28 from storage engine

Problem with SQL: select count(*), sum(table_rows) from chkdb_tabsTable 'CheckMyPages.chkdb_tabs' doesn't exist

There are tables and stored procedures matching chk_
Contains approximately
Problem with SQL: select sum( 100 - priority ) / count( distinct table_name ) from chkdb_out Table 'CheckMyPages.chkdb_out' doesn't exist
records
With an overall score of 100%
Report took 0 seconds to run

Problem with SQL: select table_name, txt, priority, field_name from ( select table_name, txt, priority, seq, field_name from chkdb_out order by priority limit 100 ) xxx order by table_name, priority, seq + 0 desc Table 'CheckMyPages.chkdb_out' doesn't exist


by Mike Robinson