How to get size of column in mysql table

mysql, sql

Solution

If you want to find out the size of column=COLUMN_NAME from table=TABLE_NAME, you can always run a query like this:

SELECT sum(char_length(COLUMN_NAME)) 
FROM TABLE_NAME;

Size returned is in bytes. If you want it in kb, you could just divide it by 1024, like so:

SELECT sum(char_length(COLUMN_NAME))/1024 
FROM TABLE_NAME;

Problem

I'm trying to find out the exact size of one column within a table. PHPMyAdmin doesn't show size of columns, only the tables. Any way I can get the size of the column? Thankyou

Original source

Related problems