Click Fraud Protection
PHP related blog, freelancer to hire!

Archive for the mySQL Category

How to calculate database size in MySQL using sql query?

SELECT count(*) TABLES, concat(round(sum(table_rows)/1000000,2),’M’) rows, concat(round(sum(data_length)/(1024*1024*1024),2),’G’) DATA, concat(round(sum(index_length)/(1024*1024*1024),2),’G’) idx, concat(round(sum(data_length+index_length)/(1024*1024*1024),2),’G’) total_size, round(sum(index_length)/sum(data_length),2) idxfrac FROM information_schema.TABLES WHERE  TABLE_SCHEMA = ‘YOUR DATABASE NAME’;

Read more

How to return all magento product SKUs in one SQL?

Sometimes when you create some cart rules in magento you want to use condition that product SKU “is not one of” you can insert comma separated list of SKUs there to give you just idea look below   connect to your database from CLI or use phpMyAdmin

Read more