UPDATE에 대한 테스트 데이터를 생성하는 방법 : 내 알고리즘 (또는 그 문제에 대한 임의의 알고리즘)의 모든 가장자리 경우에 데이터를 계산하는 기술을 찾고 있어요.
내가 지금까지 시도한 은 단지 가장자리의 사례 + 일부 "임의"데이터를 생성하는 것에 대해 생각하고 있지만 실제 사용자가 할 수있는 뭔가를 놓치지 않았다는 것을 어떻게 확신 할 수 있을지 모르겠다.는 "다른 행의 데이터를 기준으로 그룹화"알고리즘
내가 내 알고리즘에서 중요한 것을 놓치지 않았다 검사 할 ... 망치와 나는 가능한 모든 상황을 커버하는 테스트 데이터를 생성하는 방법을 모른다 :
이작업가이다 Event_Date
에 대한 데이터의 스냅 샷을보고하지만 에 속하는 편집에 대해 별도의 행을 만듭니다. Event_Date
- 입력 및 출력 데이터 그림에 그룹 2)를 참조하십시오 :
- 이
event_date
의 목록을 확인하고 - 그들을 위해
next_event_date
의 계산 :내 알고리즘 결과를
main_audit_table
에 합류하고 각 스냅 샷에 대해 가장 큰transaction_id
을 계산하십시오 (내 illustra의 그룹 1-4 기) -id
,event_date
에 의해transaction_date < next_event_date
사실인지에 따라이 옵션 여부 - 별로 그룹화 된 결과에
main_audit_table
이 같은transaction_id
- 에서 다른 데이터를 얻기 위해 가입 결과에
costs_audit_table
에 가입 - 가장 큰transaction_id
를 사용-
: 즉, 결과에서보다 작은
transaction_id
에게
내 질문 (들)입니다
내 코드 :
select
snapshots.id,
snapshots.event_date,
main.event,
main.transaction_date as last_change,
costs.costs as costs_2012
from (
--snapshots that return correct transaction ids grouped by event_date
select
main_grp.id,
main_grp.event_date,
max(main_grp.transaction_id) main_transaction_id,
max(costs_grp.transaction_id) costs_transaction_id
from main_audit_table main_grp
join (
--list of all event_dates and their next_event_dates
select
id,
event_date,
coalesce(lead(event_date) over (partition by id order by event_date),
'1.1.2099') next_event_date
from main_audit_table
group by main_grp.id, main_grp.event_date
) list on list.id = main_grp.id and list.event_date = main_grp.event_date
left join costs_audit_table costs_grp
on costs_grp.id = main_grp.id and
costs_grp.year = 2012 and
costs_grp.transaction_id <= main_grp.transaction_id
group by
main_grp.id,
main_grp.event_date,
case when main_grp.transaction_date < list.next_event_date
then 1
else 0 end
) snapshots
join main_audit_table main
on main.id = snapshots.id and
main.transaction_id = snapshots.main_transaction_id
left join costs_audit_table costs
on costs.id = snapshots.id and
costs.transaction_id = snapshots.costs_transaction_id
이 데이터를 모델링하는 방법과 이러한 그룹을 할당하는 방법을 명확히 할 수 있습니까? – Kodra
@Kodra 모델로 - IBM Tivoli Service Request Manager * 감사 테이블 (수십 개의 사용자 정의 필드가있는 a_workorder) + 사용자 정의 감사 테이블 - 최신 문서 및 리버스 엔지니어링 기술이없는 것이 좋습니다. – Aprillion
@Kodra 내 알고리즘의 2 번에서 그룹 할당이 명확해야합니다. 그렇지 않다면 정확하지 않은 점을 말해주세요. 덕분에 다시 쓸 수 있습니다. – Aprillion