Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Replace NULL Discounts With Zero

Return each product's name and its discount, showing 0 when the discount is NULL. Order by id.

Table schema

Products(id INT PRIMARY KEY, name VARCHAR(50), discount INT NULL)

Sample data

id | name | discount
1 | Pen | 10
2 | Book | NULL
3 | Bag | 5

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.