시작하기무료로 시작하기

데이터 품질 검증

데이터는 언제나 깔끔하지 않아요. track 테이블의 composer 필드와 artist 테이블의 name에는 모두 곡의 저자 정보가 들어 있습니다. 각 트랙에 대해 이 필드들의 데이터 품질을 검증해 보려고 합니다. 이를 위해 CASE 문과 JOIN된 테이블의 열을 사용할 거예요. 자, 시작해 볼까요.

이 연습은 강의의 일부입니다

Snowflake에서 데이터 조작

강의 보기

연습 안내

  • track.composer 필드가 NULL이면 'Track Lacks Detail'로 라벨링하세요.
  • track.composerartist.name과 일치하면 'Matching Artist'를 반환하세요.
  • 마지막으로, artist_id 필드를 사용해 artist 테이블을 albumLEFT JOIN하세요. 참고로 trackalbum은 이미 조인되어 있습니다.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

SELECT
    track.name,
    track.composer,
    artist.name,
    CASE
    	-- A 'Track Lacks Detail' if the composer field is NULL
        WHEN track.composer ___ ___ THEN 'Track Lacks Detail'
        -- Use the composer and artist name to determine if a match exists
        ___ track.composer = ___.name ___ '___'
        ELSE 'Inconsistent Data'
    END AS data_quality
FROM store.track AS track
LEFT JOIN store.album AS album ON track.album_id = album.album_id
-- Join the album table to artist using the artist_id field
___ JOIN store.___ AS artist ON album.___ = ___.___;
코드 편집 및 실행