mysql里如何删除 长度小于2的 记录

<p></p> <pre accuse="aContent" class="best-text mb-10" id="best-content-439209165"> delete dede_addron where char_length(trim(contant))&lt;100 delete dede_addron where char_length(contant)&lt;100</pre> <p></p> <p>如果<span> USING</span>已经产生,而结果字符串不符合给出的字符集,则会发出警告。<span> </span>同样,如果严格的<span>SQL</span>模式被激活,则<span>CHAR()</span>的结果会成为<span> NULL</span>。</p> <p></p> <p></p> <ul type="disc"> <li><span>CHAR_LENGTH(<i>str</i>) </span></li> </ul> <p><span>返回值为字符串</span><span><i><span>str</span></i></span><span> </span><span>的长度,长度的单位为字符。一个多字节字符算作一个单字符。<i>对于一个</i>包含五个二字节字符集<span>, LENGTH()</span>返回值为<span> 10, </span>而<span>CHAR_LENGTH()</span>的返回值为<span>5</span>。 </span></p> <ul type="disc"> <li><span>CHARACTER_LENGTH(<i>str</i>) </span></li> </ul> <p><span>CHARACTER_LENGTH()</span><span>是<span>CHAR_LENGTH()</span>的同义词。</span></p> <ul type="disc"> <li><span>COMPRESS(<i>string_to_compress</i>) </span></li> </ul> <p><span>压缩一个字符串。这个函数要求<span> MySQL</span>已经用一个诸如<span>zlib</span>的压缩库压缩过。<span> </span>否则,返回值始终是<span>NULL</span>。<span>UNCOMPRESS() </span>可将压缩过的字符串进行解压缩。 </span></p> <p><span>mysql&gt; <b>SELECT LENGTH(COMPRESS(REPEAT(&#39;a&#39;,1000)));</b></span></p> <p><span> -&gt; 21</span></p> <p><span>mysql&gt; <b>SELECT LENGTH(COMPRESS(&#39;&#39;));</b></span></p> <p><span> -&gt; 0</span></p> <p><span>mysql&gt; <b>SELECT LENGTH(COMPRESS(&#39;a&#39;));</b></span></p> <p><span> -&gt; 13</span></p> <p><span>mysql&gt; <b>SELECT LENGTH(COMPRESS(REPEAT(&#39;a&#39;,16)));</b></span></p> <p><span> -&gt; 15</span></p> <p><span>压缩后的字符串的内容按照以下方式存储:</span></p> <ul type="disc"> <li> <ul type="circle"> <li><span>空字符串按照空字符串存储。</span></li> <li><span>非空字符串未压缩字符串的四字节长度进行存储<span>(</span>首先为低字节<span>),</span>后面是压缩字符串。如果字符串以空格结尾,就会在后加一</span><span>个<span>&quot;.&quot;</span>号</span><span>,</span><span>以防止当结果值是存储在</span><span>CHAR</span><span>或<span>VARCHAR</span>类型</span><span>的字段列时</span><span>,</span><span>出现自动把结尾空格去掉的现象。</span><span>(</span><span>不推荐使用<span> CHAR </span>或<span>VARCHAR </span>来存储压缩字符串。最好使用一个<span> BLOB </span>列代替)<span>。 </span></span></li> </ul> </li> <li><span>CONCAT(<i>str1</i>,<i>str2</i>,...) </span></li> </ul> <p><span>返回结果为连接参数产生的字符串。如有任何一个参数为<span>NULL </span>,则返回值为<span> NULL</span>。或许有一个或多个参数。 如果所有参数均为非二进制字符串,则结果为非二进制字符串。 如果自变量中含有任一二进制字符串,则结果为一个二进制字符串。一个数字参数被转化为与之相等的二进制字符串格式;若要避免这种情况,可使用显式类型<span> cast, </span>例如:<span> SELECT CONCAT(CAST(int_col AS CHAR), char_col) </span></span></p> <p><span>mysql&gt; <b>SELECT CONCAT(&#39;My&#39;, &#39;S&#39;, &#39;QL&#39;);</b></span></p> <p><span> -&gt; &#39;MySQL&#39;</span></p> <p><span>mysql&gt; <b>SELECT CONCAT(&#39;My&#39;, NULL, &#39;QL&#39;);</b></span></p> <p><span> -&gt; NULL</span></p> <p><span>mysql&gt; <b>SELECT CONCAT(14.3);</b></span></p> <p><span> -&gt; &#39;14.3&#39;</span></p> <ul type="disc"> <li><span>CONCAT_WS(<i>separator</i>,<i>str1</i>,<i>str2</i>,...) </span></li> </ul> <p></p>
RangeTime:0.007922s
RangeMem:207.59 KB
返回顶部 留言