1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Functions and Stored Procedures in SQL Server

Exercise

Hot Deck imputation

Create a function named dbo.GetTripDistanceHotDeck that returns a TripDistance value via Hot Deck methodology. TripDistance should have a precision of 18 and 4 decimal places.

Instructions

100 XP
  • Create a function named dbo.GetTripDistanceHotDeck() that returns a numeric data type.
  • Select the first TripDistance value from YellowTripData sample of 1000 records.
  • The sample of 1000 records should only include those where TripDistance is more than zero.