题目
题目

COMP4338 COMP5338 (NE) Out of Class Quiz -- Week 7

多项选择题

Which of the following queries could return the same person–movie pair more than once, even if the dataset guarantees that there is at most one PRODUCED relationship and at most one REVIEWED relationship between any person and movie

选项
A.MATCH (p1:Person)-[:FOLLOWS]->(p2:Person),       (p1)-[:REVIEWED]->(m:Movie) RETURN p1.name, m.title;
B.MATCH (p:Person)-[:REVIEWED]->(m:Movie)<-[:PRODUCED]-(p) RETURN p.name, m.title;
C.MATCH (p:Person)-[:PRODUCED]->(m:Movie) RETURN p.name, m.title;
D.MATCH (p:Person)-[r]->(m:Movie) WHERE type(r) IN ['PRODUCED','REVIEWED'] RETURN p.name, m.title;
E.MATCH (p:Person)-[r]->(m:Movie) WHERE (p)-[:REVIEWED]->(m) RETURN p.name, m.title;
查看解析

查看解析

标准答案
Please login to view
思路分析
We’re asked which queries could return the same person–movie pair more than once, given constraints: at most one PRODUCED relationship and at most one REVIEWED relationship between any person and movie. Option 1: MATCH (p1:Person)-[:FOLLOWS]->(p2:Person), (p1)-[:REVIEWED]->(m:Movie) RETURN p1.name, m.title; This query forms a cartesian product between all pairs where p1 follows some p2 and where the same p1 has reviewed a movie m. If a given p1 follows multiple other people, and p1 has reviewed multiple different movie......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!