我的回答是否正确 [英] Is my answer correct

查看:65
本文介绍了我的回答是否正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写查询以显示已发布帖子的用户的姓名和帖子内容,按名称排序,然后按发布日期排序,然后按帖子内容排序。



我的尝试:



Write a query to display the names of the users who have posted posts and the contents of posts, sorted by name, then by post date and then by post content.

What I have tried:

selectuser.name,post.content from user
inner join post
on user.id=post.user_id
order by user.name,date(date);

推荐答案

嗯,它需要select和user.name之间的空格,并且终止分号是多余的 - 但唯一的方法是尝试它。

而且我更愿意看到SQL关键字大写。

Well, it needs a space between "select" and "user.name", and the terminating semicolon is redundant - but the only way to be sure is to try it.
And I'd prefer to see SQL keywords in upper case.
SELECT user.name,post.content FROM user
INNER JOIN post
ON user.id = post.user_id
ORDER BY user.name,date(date)



要完成这个问题,你也应该按内容排序,不是吗?


To complete the question though, you should be sorting by content as well, shouldn't you?


这篇关于我的回答是否正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆