【发布时间】:2020-05-11 19:28:23
【问题描述】:
我有一个包含数百万条目的数据集,其中包含歌曲及其艺术家。
我有
a track_id
an artist_id.
有 3 张桌子
tracks (track_id, title, artist_id),
artists(artist_id and artist_name) and
artist_term (artist_id and term).
仅使用一个查询,我必须计算其艺术家没有任何链接词的曲目数量。
更多参考,DB的架构如下:
CREATE TABLE tracks (track_id text PRIMARY KEY, title text, release text, year int, duration real, artist_id text);
CREATE TABLE artists (artist_id text, artist_name text);
CREATE TABLE artist_term (artist_id text, term text, FOREIGN KEY(artist_id)
REFERENCES artists(artist_id));
如何找到解决方案?请帮忙!
【问题讨论】:
标签: python sql sqlite pysqlite