Sobes.tech
Middle

Es ist notwendig, eine Abfrage zu schreiben, die den vorletzten geladenen Eintrag nach dem Schlüssel id zurückgibt: |id |msisdn |tarif_plan_id|account_id|raw_dt | |------------|-----------|-------------|----------|-----------| |[phone]|5842 |4979 |[phone]| |[phone]|4563 |0832 |[phone]| |[phone]|4563 |0832 |[phone]| Es gibt eine Tabelle mit Abonnenten und Änderungsverlauf. Jeder Eintrag pro Abonnent ist im Zeitraum von valid_from_dt bis valid_to_dt gültig. Wenn ein Eintrag geschlossen wird, beginnt der nächste am selben Datum. Für jeden Abonnenten sollte nur ein aktiver Eintrag im Intervall [valid_from_dt, valid_to_dt] vorhanden sein. select * from abnt |id|valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |--|-------------|-----------|-------------|-------------|----------| |1 |[phone] |[phone] |[phone] |4375 |4979 | |1 |[phone] |[phone] |[phone] |5842 |4979 | |2 |[phone] |[phone] |[phone] |4563 |5326 | |2 |[phone] |[phone] |[phone] |4563 |0832 | Es ist notwendig, eine Abfrage zu schreiben, die die Datensätze mit inkorrektem Abschlussdatum zurückgibt. |id|valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |--|-------------|-----------|-------------|-------------|----------| |1 |[phone] |[phone] |[phone] |5842 |4979 | |2 |[phone] |[phone] |[phone] |4563 |5326 |