我有以下关系:
form.games
现在我要列出在特定影院播放的电影的平均长度,并且我要在查询下面写字。
movies(MovieCode(pk), Title, Rating, Length) //pk=primary key
theaters(TheaterCode(pk), Name, Address, Phone)
movies2theaters(MovieCode, TheaterCode, MovieTime)
我的输出低于输出:
select
avg(m.length) as 'Average Length'
from
movies m,
theaters t,
movies2theaters mt
where
m.moviecode = mt.moviecode
AND t.theatercode = mt.theatercode
AND t.name = 'XYZ';
Null绝对不是输出。我不确定如何在别名列上使用聚合函数来获得正确的输出。任何帮助表示赞赏。