ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Writing Functions and Stored Procedures in SQL Server

Ver curso

Instrucciones del ejercicio

  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- 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 y ejecutar código