In mysql sql query, determining a byte length field contents

CHAR_LENGTH ( " China Times 00 " ) length of 6 
LENGTH ( " China Times 00 " ) length 18 bytes, no matter Chinese or English are considered 3 bytes 

the SELECT * the FROM (the SELECT Field 1, Field 2, Field 3, the CHAR_LENGTH (field 4) AS dd FROM table name) the WHERE dd SS> . 5 

inquiry step :( 1 ), the SELECT field 1, field 2, field 3, CHAR_LENGTH (field 4) AS dd FROM table name \\ CHAR_LENGTH (field 4) the data length field is a query 
    step :( 2 ), the step ( 1 ) and nested named, the step 1 shows the results of the query to determine dd, assuming byte field is set to VARCHAR ( 10 ), the step ( 1 ) check out field content halve the number 5, as follows: 
                the SELECT * the FROM (the SELECT field 1, field 2, field 3, CHAR_LENGTH (field 4) aS dd FROM table name) the WHERE dd SS> 5 \\ greater than 5 can query dd the content of the field is greater than 10 bytes of data

 

Guess you like

Origin www.cnblogs.com/yanchaohui/p/11981450.html