MySQL: Copy table structure to excel using Sequel Pro
Just run this command and copy all results:
describe table_name;Or if need more infomation about structure:
SELECT * from information_schema.columns WHERE table_schema = 'database_name' AND table_name = 'table_name';
Or export to file:
SELECT * from information_schema.columns WHERE table_schema = 'database_name' AND table_name = 'table_name' INTO OUTFILE '/tmp/export.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n';
By
minhbkpro
|
Monday, 18 April 2016
|
MySQL
|
0 Comments
Read More ...
MySQL: Convert NULL value to 0
From
SUM(column) as totalto
SUM(IFNULL(column, 0)) as total
By
minhbkpro
|
Thursday, 17 September 2015
|
MySQL
|
0 Comments
Read More ...
MySQL: Cast unsigned column to signed when calculate
Error "Numeric value out of range" when calculate with unsigned column and result is negative. Solution is CAST column to signed before calculate:
SUM(column1 - column2) as totalto
SUM(CAST(column1 AS SIGNED) - CAST(column2 AS SIGNED)) as total
By
minhbkpro
|
Monday, 22 June 2015
|
MySQL
|
0 Comments
Read More ...