Sunday, March 30, 2014

Select longest records from the database

To find the longest record in your table you can use this query:
SELECT max(length(column_name)) from table_name 
This can help you in optimizing the size of your tables.
SELECT column_name FROM table_nameWHERE length(column_name) =
( SELECT max(length(
( SELECT max(length(column_name)) from table_name );
Result is a list of records with the longest length

No comments: