How to remove null values from Mysql

Source: Internet
Author: User

In Mysql, the field null has two different meanings: 1. The field value is null; 2. The field value is a null string to remove the null value: SQL code create table B select column 1, column 2, IFNULL (column 3, 'I am null') as column 3, IFNULL (column 4,-999) as column 4... from table A; Description: in Table A, if column 3 is NULL, it is replaced with the string 'I am null'. If Column 4 is NULL, it is replaced with the value-999. (The return value of the IFNULL function. If the column is not empty, the original value is returned. The type of the value is consistent according to the field type; otherwise, the value you defined is returned .) Remove null strings (using the update statement): SQL code update table A set field 1 = 'value you want to replace 'where Field 1 = '';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.