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