SQL statement Common Errors

Source: Internet
Author: User

1. Warning: NULL values are eliminated for aggregation or other set operations.

Cause:

When an aggregate function is executed, the null value is operated.

For example:

The data in the table is

Num: 10, 23, null, 23

This warning is prompted when select sum (Num) from table is executed.

Generally, this warning does not affect the result.

Solution:

(1) Change the Database Value, update num = 0 where num = NULL

(2) Set ansi_warnings off

If an aggregate function (such as sum, AVG, Max, Min, STDev, stdevp, VAR, varp, or count) has a null value when it is set to on, a warning message is generated. When it is set to off, no warning is issued.
When it is set to on, zero division errors and Arithmetic overflow errors will cause rollback statements and generate error messages. When it is set to off, the null value is returned due to the division-by-zero error and Arithmetic overflow error. IfCharacter, Unicode orBinaryAn insert or update operation is performed on the column. If the length of the new values in these columns exceeds the maximum column size, the null value is returned due to the division-by-zero error and Arithmetic overflow error. If set ansi_warnings is on, insert or update is canceled as specified by the SQL-92 standard. Trailing spaces of character columns are ignored, while trailing zeros of binary columns are ignored. When it is set to off, the data is cropped to the column size and the statement is successfully executed.

 

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.