{"action":"created","comment":{"url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/comments/351950858","pull_request_review_id":324485089,"id":351950858,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1MTk1MDg1OA==","diff_hunk":"@@ -74,22 +74,39 @@ public String toString() {\n      *\n      * @param goodsId 指定的商品ID\n      * @return 有多少用户买过这个商品\n+     *\n      */\n // 例如，输入goodsId = 1，返回2，因为有2个用户曾经买过商品1。\n // +-----+\n // |count|\n // +-----+\n // | 2   |\n // +-----+\n+\n+    /**\n+     * @param databaseConnection 数据库连接\n+     * @param goodsId 指定的商品ID\n+     * @return 有多少用户买过这个商品\n+     * @throws SQLException Sql异常\n+     */\n     public static int countUsersWhoHaveBoughtGoods(Connection databaseConnection, Integer goodsId) throws SQLException {\n-        return 0;\n+        int result = 0;\n+        try (PreparedStatement preparedStatement = databaseConnection.\n+                prepareStatement(\"SELECT COUNT(*) AS COUNT FROM (SELECT DISTINCT USER_ID FROM \\\"ORDER\\\" WHERE GOODS_ID = ?);\")) {","path":"src/main/java/com/github/hcsp/sql/Sql.java","position":37,"original_position":37,"commit_id":"3133c7883e9e8ba70313f1f0cedfa91a458004ed","original_commit_id":"3133c7883e9e8ba70313f1f0cedfa91a458004ed","user":{"login":"thoughtliuw","id":23280360,"node_id":"MDQ6VXNlcjIzMjgwMzYw","avatar_url":"https://avatars3.githubusercontent.com/u/23280360?v=4","gravatar_id":"","url":"https://api.github.com/users/thoughtliuw","html_url":"https://github.com/thoughtliuw","followers_url":"https://api.github.com/users/thoughtliuw/followers","following_url":"https://api.github.com/users/thoughtliuw/following{/other_user}","gists_url":"https://api.github.com/users/thoughtliuw/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtliuw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtliuw/subscriptions","organizations_url":"https://api.github.com/users/thoughtliuw/orgs","repos_url":"https://api.github.com/users/thoughtliuw/repos","events_url":"https://api.github.com/users/thoughtliuw/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtliuw/received_events","type":"User","site_admin":false},"body":"这里写错了，应该是`SELECT DISTINCT USER_ID，GOODS_ID`","created_at":"2019-11-29T00:58:05Z","updated_at":"2019-11-29T00:58:05Z","html_url":"https://github.com/hcsp/practise-select-sql/pull/49#discussion_r351950858","pull_request_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/comments/351950858"},"html":{"href":"https://github.com/hcsp/practise-select-sql/pull/49#discussion_r351950858"},"pull_request":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49","id":346745744,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQ2NzQ1NzQ0","html_url":"https://github.com/hcsp/practise-select-sql/pull/49","diff_url":"https://github.com/hcsp/practise-select-sql/pull/49.diff","patch_url":"https://github.com/hcsp/practise-select-sql/pull/49.patch","issue_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/49","number":49,"state":"closed","locked":false,"title":"查询sql实战","user":{"login":"thoughtliuw","id":23280360,"node_id":"MDQ6VXNlcjIzMjgwMzYw","avatar_url":"https://avatars3.githubusercontent.com/u/23280360?v=4","gravatar_id":"","url":"https://api.github.com/users/thoughtliuw","html_url":"https://github.com/thoughtliuw","followers_url":"https://api.github.com/users/thoughtliuw/followers","following_url":"https://api.github.com/users/thoughtliuw/following{/other_user}","gists_url":"https://api.github.com/users/thoughtliuw/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtliuw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtliuw/subscriptions","organizations_url":"https://api.github.com/users/thoughtliuw/orgs","repos_url":"https://api.github.com/users/thoughtliuw/repos","events_url":"https://api.github.com/users/thoughtliuw/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtliuw/received_events","type":"User","site_admin":false},"body":"<!--- 你要打开的这个Pull request(PR)的类型是？默认是题目解答，如果你正在修复当前的仓库的缺陷，请选择对应的类型 -->\r\n\r\n- [x] 这个PR解答了当前仓库中的题目（机器人会自动判题并合并当前PR）\r\n- [ ] 这个PR修复了当前仓库中的一些代码缺陷（机器人不会判题，而是由管理员来处理当前PR）\r\n\r\n","created_at":"2019-11-28T15:13:02Z","updated_at":"2019-11-29T00:58:05Z","closed_at":"2019-11-28T15:14:23Z","merged_at":"2019-11-28T15:14:22Z","merge_commit_sha":"120b0df82487832d80852c70bf383a8826b34422","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1554354736,"node_id":"MDU6TGFiZWwxNTU0MzU0NzM2","url":"https://api.github.com/repos/hcsp/practise-select-sql/labels/from:VIP","name":"from:VIP","color":"3b5dab","default":false,"description":null},{"id":1554354754,"node_id":"MDU6TGFiZWwxNTU0MzU0NzU0","url":"https://api.github.com/repos/hcsp/practise-select-sql/labels/is:answer","name":"is:answer","color":"008672","default":false,"description":null}],"milestone":null,"commits_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49/commits","review_comments_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49/comments","review_comment_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/49/comments","statuses_url":"https://api.github.com/repos/hcsp/practise-select-sql/statuses/3133c7883e9e8ba70313f1f0cedfa91a458004ed","head":{"label":"hcsp:Thoughtliuw-branch","ref":"Thoughtliuw-branch","sha":"3133c7883e9e8ba70313f1f0cedfa91a458004ed","user":{"login":"hcsp","id":47730780,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NzMwNzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47730780?v=4","gravatar_id":"","url":"https://api.github.com/users/hcsp","html_url":"https://github.com/hcsp","followers_url":"https://api.github.com/users/hcsp/followers","following_url":"https://api.github.com/users/hcsp/following{/other_user}","gists_url":"https://api.github.com/users/hcsp/gists{/gist_id}","starred_url":"https://api.github.com/users/hcsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcsp/subscriptions","organizations_url":"https://api.github.com/users/hcsp/orgs","repos_url":"https://api.github.com/users/hcsp/repos","events_url":"https://api.github.com/users/hcsp/events{/privacy}","received_events_url":"https://api.github.com/users/hcsp/received_events","type":"Organization","site_admin":false},"repo":{"id":202497161,"node_id":"MDEwOlJlcG9zaXRvcnkyMDI0OTcxNjE=","name":"practise-select-sql","full_name":"hcsp/practise-select-sql","private":false,"owner":{"login":"hcsp","id":47730780,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NzMwNzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47730780?v=4","gravatar_id":"","url":"https://api.github.com/users/hcsp","html_url":"https://github.com/hcsp","followers_url":"https://api.github.com/users/hcsp/followers","following_url":"https://api.github.com/users/hcsp/following{/other_user}","gists_url":"https://api.github.com/users/hcsp/gists{/gist_id}","starred_url":"https://api.github.com/users/hcsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcsp/subscriptions","organizations_url":"https://api.github.com/users/hcsp/orgs","repos_url":"https://api.github.com/users/hcsp/repos","events_url":"https://api.github.com/users/hcsp/events{/privacy}","received_events_url":"https://api.github.com/users/hcsp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hcsp/practise-select-sql","description":"Java basic practice for beginners: Database","fork":false,"url":"https://api.github.com/repos/hcsp/practise-select-sql","forks_url":"https://api.github.com/repos/hcsp/practise-select-sql/forks","keys_url":"https://api.github.com/repos/hcsp/practise-select-sql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hcsp/practise-select-sql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hcsp/practise-select-sql/teams","hooks_url":"https://api.github.com/repos/hcsp/practise-select-sql/hooks","issue_events_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/events{/number}","events_url":"https://api.github.com/repos/hcsp/practise-select-sql/events","assignees_url":"https://api.github.com/repos/hcsp/practise-select-sql/assignees{/user}","branches_url":"https://api.github.com/repos/hcsp/practise-select-sql/branches{/branch}","tags_url":"https://api.github.com/repos/hcsp/practise-select-sql/tags","blobs_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/refs{/sha}","trees_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hcsp/practise-select-sql/statuses/{sha}","languages_url":"https://api.github.com/repos/hcsp/practise-select-sql/languages","stargazers_url":"https://api.github.com/repos/hcsp/practise-select-sql/stargazers","contributors_url":"https://api.github.com/repos/hcsp/practise-select-sql/contributors","subscribers_url":"https://api.github.com/repos/hcsp/practise-select-sql/subscribers","subscription_url":"https://api.github.com/repos/hcsp/practise-select-sql/subscription","commits_url":"https://api.github.com/repos/hcsp/practise-select-sql/commits{/sha}","git_commits_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/commits{/sha}","comments_url":"https://api.github.com/repos/hcsp/practise-select-sql/comments{/number}","issue_comment_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/comments{/number}","contents_url":"https://api.github.com/repos/hcsp/practise-select-sql/contents/{+path}","compare_url":"https://api.github.com/repos/hcsp/practise-select-sql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hcsp/practise-select-sql/merges","archive_url":"https://api.github.com/repos/hcsp/practise-select-sql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hcsp/practise-select-sql/downloads","issues_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues{/number}","pulls_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls{/number}","milestones_url":"https://api.github.com/repos/hcsp/practise-select-sql/milestones{/number}","notifications_url":"https://api.github.com/repos/hcsp/practise-select-sql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hcsp/practise-select-sql/labels{/name}","releases_url":"https://api.github.com/repos/hcsp/practise-select-sql/releases{/id}","deployments_url":"https://api.github.com/repos/hcsp/practise-select-sql/deployments","created_at":"2019-08-15T07:44:59Z","updated_at":"2019-11-28T15:14:39Z","pushed_at":"2019-11-28T15:14:36Z","git_url":"git://github.com/hcsp/practise-select-sql.git","ssh_url":"git@github.com:hcsp/practise-select-sql.git","clone_url":"https://github.com/hcsp/practise-select-sql.git","svn_url":"https://github.com/hcsp/practise-select-sql","homepage":null,"size":120,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":12,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hcsp:master","ref":"master","sha":"6eefe1b38bf5af39c9a0eefb3c528078fd83fd15","user":{"login":"hcsp","id":47730780,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NzMwNzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47730780?v=4","gravatar_id":"","url":"https://api.github.com/users/hcsp","html_url":"https://github.com/hcsp","followers_url":"https://api.github.com/users/hcsp/followers","following_url":"https://api.github.com/users/hcsp/following{/other_user}","gists_url":"https://api.github.com/users/hcsp/gists{/gist_id}","starred_url":"https://api.github.com/users/hcsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcsp/subscriptions","organizations_url":"https://api.github.com/users/hcsp/orgs","repos_url":"https://api.github.com/users/hcsp/repos","events_url":"https://api.github.com/users/hcsp/events{/privacy}","received_events_url":"https://api.github.com/users/hcsp/received_events","type":"Organization","site_admin":false},"repo":{"id":202497161,"node_id":"MDEwOlJlcG9zaXRvcnkyMDI0OTcxNjE=","name":"practise-select-sql","full_name":"hcsp/practise-select-sql","private":false,"owner":{"login":"hcsp","id":47730780,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3NzMwNzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47730780?v=4","gravatar_id":"","url":"https://api.github.com/users/hcsp","html_url":"https://github.com/hcsp","followers_url":"https://api.github.com/users/hcsp/followers","following_url":"https://api.github.com/users/hcsp/following{/other_user}","gists_url":"https://api.github.com/users/hcsp/gists{/gist_id}","starred_url":"https://api.github.com/users/hcsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcsp/subscriptions","organizations_url":"https://api.github.com/users/hcsp/orgs","repos_url":"https://api.github.com/users/hcsp/repos","events_url":"https://api.github.com/users/hcsp/events{/privacy}","received_events_url":"https://api.github.com/users/hcsp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hcsp/practise-select-sql","description":"Java basic practice for beginners: Database","fork":false,"url":"https://api.github.com/repos/hcsp/practise-select-sql","forks_url":"https://api.github.com/repos/hcsp/practise-select-sql/forks","keys_url":"https://api.github.com/repos/hcsp/practise-select-sql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hcsp/practise-select-sql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hcsp/practise-select-sql/teams","hooks_url":"https://api.github.com/repos/hcsp/practise-select-sql/hooks","issue_events_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/events{/number}","events_url":"https://api.github.com/repos/hcsp/practise-select-sql/events","assignees_url":"https://api.github.com/repos/hcsp/practise-select-sql/assignees{/user}","branches_url":"https://api.github.com/repos/hcsp/practise-select-sql/branches{/branch}","tags_url":"https://api.github.com/repos/hcsp/practise-select-sql/tags","blobs_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/refs{/sha}","trees_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hcsp/practise-select-sql/statuses/{sha}","languages_url":"https://api.github.com/repos/hcsp/practise-select-sql/languages","stargazers_url":"https://api.github.com/repos/hcsp/practise-select-sql/stargazers","contributors_url":"https://api.github.com/repos/hcsp/practise-select-sql/contributors","subscribers_url":"https://api.github.com/repos/hcsp/practise-select-sql/subscribers","subscription_url":"https://api.github.com/repos/hcsp/practise-select-sql/subscription","commits_url":"https://api.github.com/repos/hcsp/practise-select-sql/commits{/sha}","git_commits_url":"https://api.github.com/repos/hcsp/practise-select-sql/git/commits{/sha}","comments_url":"https://api.github.com/repos/hcsp/practise-select-sql/comments{/number}","issue_comment_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues/comments{/number}","contents_url":"https://api.github.com/repos/hcsp/practise-select-sql/contents/{+path}","compare_url":"https://api.github.com/repos/hcsp/practise-select-sql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hcsp/practise-select-sql/merges","archive_url":"https://api.github.com/repos/hcsp/practise-select-sql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hcsp/practise-select-sql/downloads","issues_url":"https://api.github.com/repos/hcsp/practise-select-sql/issues{/number}","pulls_url":"https://api.github.com/repos/hcsp/practise-select-sql/pulls{/number}","milestones_url":"https://api.github.com/repos/hcsp/practise-select-sql/milestones{/number}","notifications_url":"https://api.github.com/repos/hcsp/practise-select-sql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hcsp/practise-select-sql/labels{/name}","releases_url":"https://api.github.com/repos/hcsp/practise-select-sql/releases{/id}","deployments_url":"https://api.github.com/repos/hcsp/practise-select-sql/deployments","created_at":"2019-08-15T07:44:59Z","updated_at":"2019-11-28T15:14:39Z","pushed_at":"2019-11-28T15:14:36Z","git_url":"git://github.com/hcsp/practise-select-sql.git","ssh_url":"git@github.com:hcsp/practise-select-sql.git","clone_url":"https://github.com/hcsp/practise-select-sql.git","svn_url":"https://github.com/hcsp/practise-select-sql","homepage":null,"size":120,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":12,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49"},"html":{"href":"https://github.com/hcsp/practise-select-sql/pull/49"},"issue":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/issues/49"},"comments":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/hcsp/practise-select-sql/statuses/3133c7883e9e8ba70313f1f0cedfa91a458004ed"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"thoughtliuw"}}