At 2:40 -0800 12/28/02, Arun Kumar wrote:
But if I have varchar fields won't the size of the
record vary based on the actual contents in the
varchar fields.

Arun
Of course.  My answer remains the same.  Perhaps I should
add that what all this means is that you must perform
the calculations on a per-record basis, and that these
calculations, though not especially difficult, are likely
to become fairly ugly as the number of columns in your table
increase.

Don't forget that a VARCHAR containing a 10-byte
string takes a different amount of storage than, say,
a MEDIUMTEXT, TEXT, or LONGTEXT containing a 10-byte
string.

If what you really want to do (though this is *not*
what you said) is to order by the length of a given
string column, just do:

SELECT .... , LENGTH(col_name) FROM tbl_name ... ORDER BY LENGTH(col_name);

Add the appropriate constant to the LENGTH() expression to factor
in the extra number of bytes required internally to store the column
length.  (E.g., 1 for VARCHAR, 4 for LONGTEXT.)

--- Paul DuBois <[EMAIL PROTECTED]> wrote:
 At 18:38 -0800 12/27/02, Arun Kumar wrote:
 >Dear All,
 >  I have a table 'X', I want to display the record
 >  in this table 'X' which has occupied the maximum
 >  number of bytes, i.e i want a query/queries to
 >display the record with maximum size. I would also
 >like to print the
 >  record size as well.
 >
 >  Any help in this front would be great.
 >  Arun

 You'll have to calculate record size yourself based
 on knowledge
 about the types of the columns in the table and the
 storage occupied
 > by those types.

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to