Skip to content

select实战#130

Merged
hcsp-bot merged 3 commits into
hcsp:masterfrom
lance-zheng66:master
May 31, 2020
Merged

select实战#130
hcsp-bot merged 3 commits into
hcsp:masterfrom
lance-zheng66:master

Conversation

@lance-zheng66

Copy link
Copy Markdown
Contributor

SQL语言SELECT实战

@hcsp-bot

Copy link
Copy Markdown
Contributor

🎉 感谢提交Pull Request!请稍等片刻,我们已经将其提交到CI进行检查,一旦有结果会立即通知您!
不过,我们发现你在这个仓库中还打开了其他的Pull Request:

#129

我们不鼓励同时打开多个Pull Request,请集中精力于现在的这个Pull Request,谢谢!:pray:

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.* 。

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.

'+' 应另起一行。

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" +
"group by 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

Copy link
Copy Markdown
Contributor

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

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

1 similar comment
@hcsp-bot

Copy link
Copy Markdown
Contributor

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

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

@hcsp-bot

Copy link
Copy Markdown
Contributor

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

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

1 similar comment
@hcsp-bot

Copy link
Copy Markdown
Contributor

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

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

@hcsp-bot

Copy link
Copy Markdown
Contributor

恭喜你,你的提交 f0fb091 已经通过我们的CI检查:Your tests passed on CircleCI!

👍 它会被自动merge后revert。请不要骄傲,继续挑战!

点击这里查看模范代码

@hcsp-bot hcsp-bot merged commit 14c453d into hcsp:master May 31, 2020
hcsp-bot added a commit that referenced this pull request May 31, 2020
" left join GOODS G on `ORDER`.GOODS_ID = G.ID")) {
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
Order order = new Order();

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.

你看这个方法是不是和getInnerJoinOrders有大量的代码重复?考虑过抽取一个公用方法出来么?

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