From 74ba96eb98e76e67eb40dee285312e1fae0428da Mon Sep 17 00:00:00 2001 From: Aysat Date: Wed, 26 Nov 2025 14:53:10 +0600 Subject: [PATCH] =?UTF-8?q?2=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D0=A1=D0=9A=D0=9B.=20=D0=92=D1=80=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=20=D0=BD=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aysat/lifecoding/SQL2.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 aysat/lifecoding/SQL2.sql diff --git a/aysat/lifecoding/SQL2.sql b/aysat/lifecoding/SQL2.sql new file mode 100644 index 0000000..96c4aeb --- /dev/null +++ b/aysat/lifecoding/SQL2.sql @@ -0,0 +1,23 @@ +with base as ( +select +employee_id, +to_dt, +from_dt, +lag(to_dt) over (partition by employee_id order by from_dt) lag_to_dt +from abakhytbekuly.salary +), +error as ( +select +employee_id, +from_dt, +case when + lag_to_dt > from_dt then 'пересечение' + when + lag_to_dt < from_dt then 'дыра' + end as status +from base +where lag_to_dt is not null +) +select * +from error +order by employee_id, from_dt \ No newline at end of file