SingerId[pk] SingerName City DOB Gender
1 A Hyderabad 14-Apr-65 M
2 B Chennai 25-May-84 M
3 C Bangalore 14-Sep-78 F
4 D Hyderabad 17-Jan-70 M
5 E Hyderabad 18-Mar-87 F
6 F Bangalore 23-Aug-75 F
MovieId[pk] MovieName ReleaseDate
1 AAA 12-Jan-15
2 BBB 19-Sep-12
3 CCC 23-Jul-10
4 DDD 06-Oct-01
5 EEE 08-Nov-05
6 FFF 18-Apr-99
7 GGG 07-Aug-12
表现
PerformanceId[pk] SingerId[fk] MovieId[fk] NumberofSongs
1 1 1 2
2 3 1 4
3 2 2 6
4 4 5 3
5 5 5 3
6 2 6 2
7 4 6 5
8 6 4 6
9 6 3 3
10 4 3 4
问:列出歌手的详细信息,电影详情以及歌曲数量
对于上面的要求,我尝试了以下查询::
SELECT a.singer_id,a.singer_name,a.city,a.dob,c.movie_name,c.release_date,b.nof_songs
FROM singer a
INNER JOIN performance b
ON a.singer_id=b.singer_id
INNER JOIN movies c
ON c.movie_id=b.movie_id
但没有得到确切的结果。 请帮我找出确切的结果。
答案 0 :(得分:0)
SELECT Singer.*,
Performance.nof_songs,
movies.movie_id, movies.movie_name, movies.release_date
FROM movies
INNER JOIN Performance ON movies.movie_id = Performance.movie_id
INNER JOIN Singer ON Performance.singer_id = Singer.singer_id