SQL从查询中选择

时间:2014-04-15 21:10:37

标签: sql

进行修订,无法解决过去的考试问题。

完成以下SQL语句,以便找到最早的日期 任何一个展览中都有画作。 E3500或E5500:

SELECT . . . 
 FROM . .

这些是表

Sponsor (sponsor_no, sponsor_name, sponsor_address, telephone_no, . . .) 
Exhibition (exhibition_no, location, curator, . . .) 
Visitor (visitor_no, visitor_name, visitor_address . . .) 
Visit (visit_no, visitor_no, exhibition_no, date, entry-time, exit_time . . .) 
Painting (painting_no, description, date_of_painting, exhibition_no . . .)

2 个答案:

答案 0 :(得分:1)

SELECT MIN(date_of_painting)
FROM   painting
WHERE  exhibition_no IN ('E3500', 'E5500')

答案 1 :(得分:-1)

检查此查询,

Select MIN(P.date_of_painting) From Painting P Inner Join Exhibition E
On E.exhibition_no = P.exhibition_no 
Where P.exhibition_no = 'E3500' or P.exhibition_no = 'E5500'

希望这会对你有所帮助。