mysql問題

1有 關係模式:User(userId, userName), Article(articleId, userId, title, content),Vote(articleId, score),User爲用戶關係,Article爲用戶發表的文章關係,Vote爲文章得票關係,title爲文章標題、score爲得票數。 (1)用SQL語言查詢出發表文章數大於5,文章平均得票數大於100的用戶名,按平均得票數倒序排列; select dd.userName from (select User.userName as userName,aa.userId as userId from User,(select userId,count(*) as ant from Article group by userId)as aa where User.userId = aa.userId and aa.ant >5) as dd,(select Article.userId as userId, avg(Vote.score) as avg from Vote,Article where Article.articleId=Vote.articleId group by Article.userId) as cc where dd.userId = cc.userId and cc.avg>100 order by cc.avg desc;it

相關文章
相關標籤/搜索