How to retrieve null values and null values in a database

Source: Internet
Author: User

The database does not have the following values:

1. null if it seems that the cell is blank, It is the null value.
2.0 occasionally, some cells are '0' by default. The value 0 may be char or Int, so it is divided into 0 and '0' (that is, single quotes + 0 ).
3. null This NULL is not another null, And This NULL is 'null' (that is, single quotes + null). I have met it once, inCodeAll null values are filled with null. It is intended to be filled with null, and the result is eventually 'null', which is a string consisting of four letters.
To retrieve all the above three items, you can use the following sentence, even if you do not match all the three points, you can use it. It is good to skip one.
Select id_gradebase, id_college, id_majorsecmajor
From xsstu
Where id_gradebase = '0' or id_college = '0' or id_majorsecmajor = '0' or isnull (id_gradebase, '') +'' = ''or isnull (id_college ,'') + ''='' or isnull (id_majorsecmajor, '') +'' = ''or id_gradebase = 'null' or id_college = 'null' or id_majorsecmajor = 'null'

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.