i need to know how to get the max size of an specific column in mysql, the table is
turno :
CREATE TABLE `turno` (
`idTurno` tinyint(4) NOT NULL,
`nombreTurno` varchar(20) COLLATE utf8_spanish2_ci NOT NULL,
`horaInicio` tinyint(4) NOT NULL,
`horafin` tinyint(4) NOT NULL,
`valorTurno` int(11) NOT NULL,
PRIMARY KEY (`idTurno`))
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci
the column :
`nombreTurno` varchar(20) COLLATE utf8_spanish2_ci NOT NULL
i should get :
20
im getting:
NULL
the query :
SELECT MAX( LENGTH( nombreTurno ) ) AS maxl
FROM turno
hope you can help me, thank you
select COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH
from information_schema.columns
where table_schema = DATABASE() AND -- name of your database
table_name = 'turno' AND -- name of your table
COLUMN_NAME = 'nombreTurno' -- name of the column
The following SQL query will give the maximum column length.
SELECT max(length(column)) `max_column_length` from tab;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With