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

Safe Division With NULLIF

Return the click-through rate clicks / impressions as a percentage rounded to two decimals for each row, or NULL when impressions is 0. Order by id.

Table schema

Stats(id INT PRIMARY KEY, clicks INT, impressions INT)

Sample data

id | clicks | impressions
1 | 10 | 100
2 | 5 | 0

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.