IsNull functions in SQL Server and the use of ifnull functions in MySQL

Source: Internet
Author: User

Tag: SQL Server SQL data MySQL

This article introduces the ISNULL functions in SQL Server, as well as the ifnull functions in MySQL, describes the specific usage and differences between the two, interested friends can study oh.

First look at the IsNull function of SQL serve:

ISNULL (Check_expression,replacement_value)

1. The data types of check_expression and Replacement_value must be identical.
2. If check_expression is null, Replacement_value is returned.
3. If check_expression is null, Check_expression is returned.

Then look at MySQL's ifnull function:

Ifnull (EXPR1,EXPR2)
Returns EXPR2 if EXPR1 is not Null,ifnull () returns EXPR1.

Below is a look at the specific usage of isnull and nullif in SQL Server.
ISNULL in SQL Server differs from ISNULL in ASP, there are two parameters in SQL Server.

One, ISNULL syntax:
ISNULL (Check_expression, Replacement_value)

1,check_expression and Replacement_value data types must be consistent
2, if Check_expression is NULL, returns Replacement_value
3, if Check_expression is not NULL, returns check_expression

Second, Nullif is used to check two expressions.
Grammar:
Nullif (expression, expression)

Description
If two expression is equal, returns NULL, which is the data type of the first expression.
If two expression is not equal, the first Expressio is returned.


IsNull functions in SQL Server and the use of ifnull functions in MySQL

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.