Code Room
Code reviewHard
Question
Review this SQL (T-SQL / SQL Server) inventory-availability check used at checkout.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
CREATE PROCEDURE dbo.CanFulfill @sku INT, @qty INT, @ok BIT OUTPUTASBEGIN SET @ok = 0; SELECT @ok = CASE WHEN on_hand >= @qty THEN 1 ELSE 0 END FROM dbo.inventory WITH (NOLOCK) WHERE sku = @sku;ENDRun or narrate your approach, then ask the coach.