1043.MovieEx-Query the names of both reviewers

时间限制: 1000 MS    内存限制: 32768 KB
提交: 187    解决: 49

题目描述

For all pairs of reviewers such that both reviewers gave a rating to the same movie, return the names of both reviewers(reviewer_name1, reviewer_name2). Eliminate duplicates, don't pair reviewers with themselves, and include each pair only once. For each pair, return the names in the pair in alphabetical order.

 

You can find the full data description here

movie ( mID, title, year, director )

English: There is a movie with ID number mID, a title, a release year, and a director.

mID

title

year

director

int

varchar

int

varchar

101

Gone with the Wind

1939

Victor Fleming

102

Star Wars

1977

George Lucas

 

reviewer ( rID, name )

English: The reviewer with ID number rID has a certain name.

rID

name

int

varchar

201

Sarah Martinez

202

Daniel Lewis

 

rating ( rID, mID, stars, ratingDate )

English: The reviewer rID gave the movie mID a number of stars rating (1-5) on a certain ratingDate.

rID

mID

stars

ratingDate

int

int

int

date

201

101

2

2011-01-22

 

来源

Unknown