ich mit einem SQL-Code stecke, wo ich brauche te Daten zu erhalten, wie folgt (ich hoffe, dass ich es gut genug erklären kann): Es gibt drei Tabellen in meiner Datenbank:SQL aus Tabelle zählen erhalten 1, wo komplizierte
Table 1 is filled with traffic accidents(VKL_NUMBER and TIME)
Table 2 is filled with the locations of the accidents and the closest weather station (VKL_NUMBER, LOCATION and STN_NUMBER)
Table 3 is filled with weather data and the weather station where it came from(STN_NUMBER, TIME, WEATHER_TYPE)
Ich muss die Anzahl der Unfälle zählen, wo es regnet. Die Schlüssel zu den Tabellen sind:
From 1 to 2: VKL_NUMBER(accident number)
From 2 to 3: STN_NUMBER (weather station number)
Wie kann ich die weathertype zum Zeitpunkt und am nächsten an den Unfall in einer Zählung Wie erhalten:
Count accidents where it rains at the closest weatherstation.
für weitere Informationen:
The accidents table has VKL_NUMBER(FK to the locations table) TIME(HHMM format) and DATE(YYMMDD format)
The locations table has VKL_NUMBER(FK to accidents), LOCATION(not important for this question) and STN_NUMBER(FK to the weather table)
The weather table had STN_NUMBER(FK to locations table), WEATHERTYPE("rain","snow","hail"), TIME(HHMM format) and DATE(YYMMDD format)
Wenn Sie sagen "wo es regnet", können Sie konkret sagen, welche Spalte diese Informationen bereitstellt? Gleiches gilt für andere Felder. – Adi
Die Unfalltabelle hat VKL_NUMBER (FK für die Lokationstabelle) TIME (HHMM Format) und DATE (YYMMDD Format) Die Lokationstabelle hat VKL_NUMBER (FK für Unfälle), LOCATION (nicht wichtig für diese Frage) und STN_NUMBER (FK für die Frage) Wetter Tabelle) Die Wetter Tabelle hatte STN_NUMBER (FK zu Standorten Tabelle), WEATHERTYPE ("regen", "Schnee", "Hagel"), TIME (HHMM Format) und DATE (YYMMDD Format) –
Warum sind die Tabellen 1 und 2 getrennt ? – Strawberry