So I have a table Car(Car_id, Value, Make)
, another table Person(Person_id, Name)
and a third table linking the two together PerCar(Car_id, Person_id)
.
(所以我有一个表Car(Car_id, Value, Make)
,另一个表Person(Person_id, Name)
和第三个表,将两者链接在一起PerCar(Car_id, Person_id)
。)
So I have this correlated subquery:
(所以我有这个相关的子查询:)
SELECT MAKE, VALUE
FROM CAR WHERE VALUE > (SELECT AVG(VALUE) FROM CAR C WHERE C.CAR_ID = CAR_ID);
So if I wanted to display the person's name also, is this also valid correlated sub query:
(因此,如果我也想显示此人的姓名,这是否也是有效的相关子查询:)
SELECT Car.Make, Car.Value, Person.Name
FROM PerCar NATURAL JOIN Car
NATURAL JOIN Person where Car.Value > (SELECT AVG(VALUE) FROM Car);
ask by Drakus translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…