Skip to content

Commit

Permalink
Fix 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanos Paravantis committed May 10, 2018
1 parent 9315e43 commit 6f6e7b0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion 2.4_FINAL.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SELECT id FROM service_history
SELECT * FROM service_history
WHERE end_date IS NULL
28 changes: 9 additions & 19 deletions JDBC_Example/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
13 changes: 9 additions & 4 deletions JDBC_Example/src/com/papei/database/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,25 @@ private static void executeD()
System.out.println("Erotima D");

Statement statement;
String query = "SELECT id FROM service_history WHERE end_date IS NULL";
String query = "SELECT * FROM service_history WHERE end_date IS NULL";

try
{
statement = conn.createStatement();
ResultSet res = statement.executeQuery(query);

System.out.format("%-5s", "ID");
System.out.format("%-5s%-10s%-10s%-10s%-20s%-20s", "ID", "Car ID", "Tech ID", "Cost", "Start Date", "End Date");

while (res.next())
{
System.out.format(
"%n%-5d",
res.getInt("id"));
"%n%-5d%-10d%-10d%-10d%-20s%-20s",
res.getInt("id"),
res.getInt("car_id"),
res.getInt("tech_id"),
res.getInt("cost"),
res.getString("start_date"),
res.getString("end_date"));
}
}
catch (SQLException e)
Expand Down

0 comments on commit 6f6e7b0

Please sign in to comment.