CommencerCommencez gratuitement

Use EDA to find impossible scenarios

Calculate how many YellowTripData records have each type of error discovered during EDA.

Cet exercice fait partie du cours

<cours>Writing Functions and Stored Procedures in SQL Server</cours>
Voir le cours

Instructions de l’exercice

  • Use CASE and COUNT to understand how many records contain the following errors:
  • DropOffDate before PickupDate, DropOffDate before today, PickupDate before today, TripDistance is zero.

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

SELECT
	-- PickupDate is after today
	COUNT (CASE WHEN ___ > ___() THEN 1 END) AS 'FuturePickup',
    -- DropOffDate is after today
	COUNT (CASE WHEN ___ > ___() THEN 1 END) AS 'FutureDropOff',
    -- PickupDate is after DropOffDate
	COUNT (CASE WHEN ___ > ___ THEN 1 END) AS 'PickupBeforeDropoff',
    -- TripDistance is 0
	COUNT (CASE WHEN ___ = ___ THEN 1 END) AS 'ZeroTripDistance'  
FROM YellowTripData;
Modifier et exécuter le code