Created
March 21, 2021 02:05
-
-
Save whymarrh/b2255aa7dcdce1b688cee3f23d64971e to your computer and use it in GitHub Desktop.
Select duplicate clues from the J! Archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Using the db from https://github.com/whymarrh/jeopardy-parser | |
WITH duplicates(clue, occurrences) AS ( | |
SELECT d.clue, COUNT(d.clue) AS occurrences | |
FROM documents AS d | |
WHERE d.clue NOT IN ( | |
'=', '...', | |
'(missing clue)', | |
'(audio clue)', '[audio clue]', '[audio]', | |
'[Instrumental theme plays]', '[instrumental]', | |
'[Music plays]', '[theme music]', | |
'[video clue]', | |
'[sports logo]', | |
'[flag]', | |
'[State outline]' | |
) | |
GROUP BY clue | |
HAVING occurrences > 1 | |
ORDER BY occurrences DESC | |
) | |
SELECT a.airdate, cats.category, d.clue, d.answer | |
FROM clues c | |
JOIN airdates a ON a.game = c.game | |
JOIN documents d ON d.id = c.id | |
JOIN classifications classes on c.id = classes.clue_id | |
JOIN categories cats on cats.id = classes.category_id | |
JOIN duplicates dupes ON dupes.clue = d.clue | |
WHERE d.clue IN ( | |
SELECT dupes.clue | |
FROM duplicates AS dupes | |
WHERE dupes.occurrences > 1 | |
ORDER BY dupes.occurrences DESC | |
) | |
ORDER BY dupes.occurrences DESC, d.clue, a.airdate | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The dependencies for the now-outdated jeopardy-parser: