嗨,我正在使用 musicbrainz 数据库,我无法计算每个国家/地区的所有艺术家,但无论我尝试哪个国家/地区,我都会遇到相同的错误,即使我尝试使用 like。PLease 谁能告诉我我做错了什么?
错误:列“%u%”不存在第 7 行:WHERE AREA.NAME LIKE “%u%”
SELECT COUNT(artist.name)
FROM artist
JOIN area ON artist.area = area.id
JOIN label ON area.id = label.area
JOIN country_area ON area.id = country_area.area
JOIN release_country ON country_area.area = release_country.country
WHERE AREA.NAME LIKE "%dom"
GROUP BY release_country.country
limit 5;
更新:
musicbrainz_db=> SELECT COUNT(artist.name)
musicbrainz_db-> FROM artist
musicbrainz_db-> JOIN area ON artist.area = area.id
musicbrainz_db-> JOIN label ON area.id = label.area
musicbrainz_db-> JOIN country_area ON area.id = country_area.area
musicbrainz_db-> JOIN release_country ON country_area.area =
release_country.country
musicbrainz_db-> WHERE AREA.NAME LIKE '%dom'
musicbrainz_db-> GROUP BY release_country.country
musicbrainz_db-> limit 5;
错误:由于语句超时而取消语句
我的老师刚过来说没有子查询就不行?
select area.name, label_count
from area
where label_count in
(
select area.name, count(label.id) as "label_count"
from area
JOIN label on area.id = label.area
group by area.name
);
子查询工作正常,但主查询失败?知道为什么。