LoslegenKostenlos loslegen

Format for Germany

Write a query to display the TotalDistance, TotalRideTime and TotalFare for each day and NYC Borough. Display the date, distance, ride time, and fare totals for German culture.

Diese Übung ist Teil des Kurses

Writing Functions and Stored Procedures in SQL Server

Kurs anzeigen

Anleitung zur Übung

  • Cast PickupDate as a date and display it as a German date.
  • Display TotalDistance and TotalRideTime in the German format ('n' format type parameter).
  • Display Total Fare as German currency ('c' format type parameter).

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

SELECT
    -- Cast PickupDate as a date and display as a German date
	___(___(___ AS date), 'd', 'de-de') AS 'PickupDate',
	Zone.Borough,
    -- Display TotalDistance in the German format
	___(SUM(TripDistance), '___', 'de-de') AS 'TotalDistance',
    -- Display TotalRideTime in the German format
	___(SUM(DATEDIFF(minute, PickupDate, DropoffDate)), '___', 'de-de') AS 'TotalRideTime',
    -- Display TotalFare in German currency
	___(SUM(TotalAmount), '___', 'de-de') AS 'TotalFare'
FROM YellowTripData
INNER JOIN TaxiZoneLookup AS Zone 
ON PULocationID = Zone.LocationID 
GROUP BY
	CAST(PickupDate as date),
    Zone.Borough 
ORDER BY
	CAST(PickupDate as date),
    Zone.Borough;
Code bearbeiten und ausführen