Obsidian/Recognition/Work Related/프로젝트/스마트계류장/1.데이터베이스/작업SQL 백업/데이터사정정의어.md

125 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

2023-08-14 16:19:25 +00:00
```SQL
select *
from datadic_list
update datadic_list
set gbn = 'EN'
where gbn is null
-- 중복자료
select item
from datadic_list d
group by item
having count(item) > 1
-- .제외
select *
from datadic_list d
-- where item like '%#%'
where item_ko like '%~%'
-- 미사용으로 변경(. / * / # / de에만 있는것 / en에만 있는것, en인것)
update datadic_list a
set useyn = 'N'
where item_ko like '%..%'
-- de에만 있는것
select *
from datadic_list d
where gbn = 'DE'
and nvl(useyn, 'Y') = 'Y'
and not exists (
select 'x'
from datadic_list c
where gbn = 'EN'
and d.item = c.item
)
-- en에만 있는것
select *
from datadic_list d
where gbn = 'EN'
and nvl(useyn, 'Y') = 'Y'
and not exists (
select 'x'
from datadic_list c
where gbn = 'DE'
and d.item = c.item
)
-- item이 한글자인것
select *
from datadic_list d
where length(item) = 1
and gbn = 'DE'
-- 동의어(중복)자료
-- create table tmp_dup as
select item, max(seq) as seq
from datadic_list d
where nvl(useyn, 'Y') = 'Y'
and gbn = 'DE'
group by item
having count(item) > 1
select count(*) from tmp_dup
-- 중복자료 동의어 처리
update datadic_list a
set mainyn = '동의어'
where gbn = 'DE'
and nvl(useyn, 'Y') = 'Y'
and exists (
select 'i'
from tmp_dup c
where c.seq = a.seq
and c.item = a.item
)
-- 최종
select seq, mainyn, replace(item_ko,' ', ''), item_en , upper(item) , item_ko
from datadic_list d
where nvl(useyn, 'Y') = 'Y'
-- SACP 용어 추가
select *
from datadic_list d
where gbn = 'SACP'
select seq, replace(item_ko,' ', ''), item_en , item , item_ko, useyn, gbn, mainyn
from datadic_list d
where nvl(useyn, 'Y') = 'Y'
select seq, item_ko, item_en , item , item_ko, useyn, gbn, mainyn
from datadic_list d
where nvl(useyn, 'Y') = 'Y'
and exists (
select 'o'
from datadic_old do2
where item_ko = replace(d.item_ko,' ', '')
-- where item = d.item
)
select *
from datadic_list dl
where item_ko like '%하다%'
and nvl(useyn, 'Y') = 'Y'
```