clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3364508 fiddles created (36254 in the last week).

CREATE TABLE Sales( [ID] INT NOT NULL, [Income] INT NULL, [Visits] INT NULL );
 hidden batch(es)


INSERT INTO Sales([ID],[Income],[Visits]) VALUES (1,1200,30), (2,0,22), (3,800,1), (4,749,7), (5,192,0), (6,974,10);
6 rows affected
 hidden batch(es)


SELECT * FROM Sales
ID Income Visits
1 1200 30
2 0 22
3 800 1
4 749 7
5 192 0
6 974 10
 hidden batch(es)


SELECT [ID],[Income]/[Visits] FROM Sales
Msg 8134 Level 16 State 1 Line 1 Divide by zero error encountered.
 hidden batch(es)


SELECT [ID],[Income]/NULLIF([Visits],0) FROM Sales
ID (No column name)
1 40
2 0
3 800
4 107
5
6 97
 hidden batch(es)