首页 > 试题广场 >

这里有两个表,请用SQL语句查询年龄小于平均年龄的作者姓名(

[问答题]

这里有两个表,请用SQL语句查询年龄小于平均年龄的作者姓名(name),图书名(name),出版社(press)。

图书表book:id, name, author_id, press, publish_date
作者表author:id, name, age, sex


图书表book:id, name, author_id, press, publish_date
作者表author:id, name, age, sex
查询年龄小于平均年龄的作者姓名(name),图书名(name),出版社(press)。
SELECT  a.name as "author name", b.name  as "book name", b.press 
FROM author AS a INNER JOIN book AS b
ON a.id=b.author_id
WHERE a.age<mean(a.age)


发表于 2019-11-25 05:54:13 回复(0)