所以这是我的作业问题:列出所有艺术家和他们拥有的独特作曲家的数量,仅限于那些作曲家大于零的艺术家。请注意,有些作曲家值具有NULL值;不要算这些!您的输出列应按该顺序列为ArtistName和ComposerCount。
到目前为止,这是我的答案:
SELECT Distinct Track.Composer AS ArtistName, Count(*) AS ComposerCount
FROM Artist,Album,Track
WHERE Artist.ArtistID = Album.ArtistID AND Track.AlbumID = Album.AlbumId
GROUP BY Track.Composer
HAVING Count(*) > 0
我的问题:我不明白如何在此问题中不计算空值。
答案 0 :(得分:0)
检查一下。
SELECT Distinct Track.Composer AS ArtistName, Count(Composer ) AS ComposerCount
FROM Artist,Album,Track
WHERE Artist.ArtistID = Album.ArtistID AND Track.AlbumID = Album.AlbumId
and Track.Composer is not null
GROUP BY Track.Composer
HAVING Count(Composer ) > 0
答案 1 :(得分:0)
所以不确定,但尝试使用Not Null的简单技巧 例如:
QLabel