Skip to content

数据库实战: SELECT命令与JDBC使用#135

Open
Jackwu1 wants to merge 2 commits into
hcsp:masterfrom
Jackwu1:master
Open

数据库实战: SELECT命令与JDBC使用#135
Jackwu1 wants to merge 2 commits into
hcsp:masterfrom
Jackwu1:master

Conversation

@Jackwu1

@Jackwu1 Jackwu1 commented Jun 8, 2020

Copy link
Copy Markdown
  • 这个PR解答了当前仓库中的题目(机器人会自动判题并合并当前PR)
  • 这个PR修复了当前仓库中的一些代码缺陷(机器人不会判题,而是由管理员来处理当前PR)

@hcsp-bot

hcsp-bot commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

🎉 感谢提交Pull Request!请稍等片刻,我们已经将其提交到CI进行检查,一旦有结果会立即通知您!

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应使用 '.*' 形式的导入 - java.sql.* 。

return 0;
// return 0;
String sql = "select count(distinct user_id) from \"ORDER\" where goods_id = ? ;";
try(PreparedStatement preparedStatement = databaseConnection.prepareStatement(sql)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'try' 后应有空格。

public static List<GoodsAndGmv> getGoodsAndGmv(Connection databaseConnection) throws SQLException {
return null;
List<GoodsAndGmv> goodsAndGmvList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select GOODS_ID, GOODS.NAME, sum(GOODS_NUM * GOODS_PRICE) as total\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

return null;
List<GoodsAndGmv> goodsAndGmvList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select GOODS_ID, GOODS.NAME, sum(GOODS_NUM * GOODS_PRICE) as total\n" +
"from `ORDER`\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

List<GoodsAndGmv> goodsAndGmvList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select GOODS_ID, GOODS.NAME, sum(GOODS_NUM * GOODS_PRICE) as total\n" +
"from `ORDER`\n" +
" join GOODS on `ORDER`.GOODS_ID = GOODS.ID\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

return null;
List<Order> orderList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select \"ORDER\".ID, U.NAME, G.NAME, GOODS_NUM * GOODS_PRICE\n" +
"from `ORDER`\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

List<Order> orderList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select \"ORDER\".ID, U.NAME, G.NAME, GOODS_NUM * GOODS_PRICE\n" +
"from `ORDER`\n" +
" join USER U on `ORDER`.USER_ID = U.ID\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

public static List<Order> getLeftJoinOrders(Connection databaseConnection) throws SQLException {
return null;
List<Order> orderList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select \"ORDER\".ID, U.NAME, G.NAME, GOODS_NUM * GOODS_PRICE\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

return null;
List<Order> orderList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select \"ORDER\".ID, U.NAME, G.NAME, GOODS_NUM * GOODS_PRICE\n" +
"from `ORDER`\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

List<Order> orderList = new ArrayList<>();
try (PreparedStatement statement = databaseConnection.prepareStatement("select \"ORDER\".ID, U.NAME, G.NAME, GOODS_NUM * GOODS_PRICE\n" +
"from `ORDER`\n" +
" left join USER U on `ORDER`.USER_ID = U.ID\n" +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+' 应另起一行。

@hcsp-bot

hcsp-bot commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

你的提交 72fa0de ,似乎失败了:Your tests failed on CircleCI

😅 请不要气馁,仔细分析原因,再接再厉!

1 similar comment
@hcsp-bot

hcsp-bot commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

你的提交 72fa0de ,似乎失败了:Your tests failed on CircleCI

😅 请不要气馁,仔细分析原因,再接再厉!

@hcsp-bot

hcsp-bot commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

你的提交 29fd745 ,似乎失败了:Your tests failed on CircleCI

😅 请不要气馁,仔细分析原因,再接再厉!

1 similar comment
@hcsp-bot

hcsp-bot commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

你的提交 29fd745 ,似乎失败了:Your tests failed on CircleCI

😅 请不要气馁,仔细分析原因,再接再厉!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants