Format für Deutschland
Schreibe eine Abfrage, die TotalDistance, TotalRideTime und TotalFare für jeden Tag und jeden NYC Borough anzeigt. Gib Datum, Distanz, Fahrzeit und Fahrpreis-Summen im deutschen Format aus.
Diese Übung ist Teil des Kurses
<Kurs>Funktionen und Stored Procedures in SQL Server schreiben</Kurs>Übungsanweisungen
- Wandle
PickupDatein den Typdateum und zeige es als deutsches Datum an. - Zeige
TotalDistanceundTotalRideTimeim deutschen Zahlenformat an (Formattyp-Parameter'n'). - Zeige
Total Fareals deutsche Währung an (Formattyp-Parameter'c').
Interaktive praktische Ü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;