This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
117 additions
and
76 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,25 @@ | ||
OR | ||
|
||
WITH recording_ids AS ( | ||
SELECT DISTINCT(recording_id) | ||
FROM tag | ||
JOIN recording_tag | ||
ON recording_tag.tag_id = tag.id | ||
JOIN recording | ||
ON recording.id = recording_tag.recording_id | ||
WHERE name in ('trip hop', 'downtempo') | ||
) | ||
SELECT recording.id | ||
, recording_name | ||
, popularity | ||
FROM recording | ||
JOIN recording_ids | ||
ON recording.id = recording_ids.recording_id | ||
JOIN recording_metadata | ||
ON recording.id = recording_metadata.recording_id | ||
WHERE popularity >= .5 | ||
AND popularity < .8 | ||
ORDER BY popularity DESC | ||
; | ||
|
||
AND | ||
|
||
WITH recording_tags AS ( | ||
SELECT DISTINCT recording.id AS recording_id | ||
, tag.name AS tag_name | ||
FROM tag | ||
JOIN recording_tag | ||
ON recording_tag.tag_id = tag.id | ||
JOIN recording | ||
ON recording.id = recording_tag.recording_id | ||
WHERE name in ('downtempo', 'trip hop') | ||
ORDER BY recording.id | ||
), recording_ids AS ( | ||
SELECT recording_tags.recording_id | ||
FROM recording_tags | ||
JOIN recording_metadata | ||
ON recording_tags.recording_id = recording_metadata.recording_id | ||
GROUP BY recording_tags.recording_id | ||
HAVING count(recording_tags.tag_name) = 2 | ||
) | ||
SELECT recording.id | ||
, recording_name | ||
, popularity | ||
FROM recording | ||
JOIN recording_ids | ||
ON recording.id = recording_ids.recording_id | ||
JOIN recording_metadata | ||
ON recording.id = recording_metadata.recording_id | ||
WHERE popularity >= .5 | ||
AND popularity < .8 | ||
ORDER BY popularity DESC | ||
; | ||
|
||
WITH recording_ids AS ( | ||
SELECT DISTINCT(recording_id) | ||
FROM tag | ||
JOIN recording_tag | ||
ON recording_tag.tag_id = tag.id | ||
JOIN recording | ||
ON recording.id = recording_tag.recording_id | ||
WHERE name in ('hindi', '4ad') | ||
) | ||
SELECT recording_mbid | ||
, popularity AS percent | ||
, subsonic_id | ||
, recording_name | ||
, artist_name | ||
FROM recording | ||
JOIN recording_ids | ||
ON recording.id = recording_ids.recording_id | ||
JOIN recording_metadata | ||
ON recording.id = recording_metadata.recording_id | ||
JOIN recording_subsonic | ||
ON recording.id = recording_subsonic.recording_id | ||
ORDER BY popularity DESC | ||
; |
This file contains 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
This file contains 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