ComeçarComece de graça

CREATE OR ALTER

Change the SumStationStats function to enable SCHEMABINDING. Also change the parameter name to @EndDate and compare to EndDate of CapitalBikeShare table.

Este exercício faz parte do curso

Writing Functions and Stored Procedures in SQL Server

Ver curso

Instruções do exercício

  • Use CREATE OR ALTER keywords to update the SumStationStats function.
  • Change the parameter name to @EndDate and data type to date.
  • Compare the @EndDate to EndDate of the CapitalBikeShare table.
  • Enable SCHEMABINDING.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

-- Update SumStationStats
___ ___ ___ FUNCTION dbo.___(___ AS ___)
-- Enable SCHEMABINDING
RETURNS TABLE ___ ___
AS
RETURN
SELECT
	StartStation,
    COUNT(ID) AS RideCount,
    SUM(DURATION) AS TotalDuration
FROM dbo.CapitalBikeShare
-- Cast EndDate as date and compare to @EndDate
WHERE CAST(___ AS Date) = ___
GROUP BY StartStation;
Editar e executar o código