Warnings in SQL
Part - 19
Click here for you tube video answer:
create table Test_table (id int)
INSERT Test_table Values (2),(8),(6),(4)
SELECT * FROM Test_table
SELECT SUM(ID) FROM Test_table
SELECT AVG(ID) FROM Test_table
SELECT MIN(ID) FROM Test_table
SELECT MAX(ID) FROM Test_table
Click on Messages:
No warnings have been shown.
Lets add a NULL value to the table and run the same queries
INSERT Test_table Values (NULL)
SELECT SUM(ID) FROM Test_table
SELECT AVG(ID) FROM Test_table
SELECT MIN(ID) FROM Test_table
SELECT MAX(ID) FROM Test_table
Click on Messages
You can see the Warning now.
The warning says it has ignored NULL Values and performed the aggregate functions
SUM(), AVG() etc...
We can avoid this warning by setting ANSI NULL OFF but this is not recommended.
Thank you, Please subscribe to my channel.
No comments:
Post a Comment