diff --git a/2.4_FINAL.sql b/2.4_FINAL.sql index 6269b80..bfa3066 100644 --- a/2.4_FINAL.sql +++ b/2.4_FINAL.sql @@ -1,2 +1,2 @@ -SELECT id FROM service_history +SELECT * FROM service_history WHERE end_date IS NULL diff --git a/JDBC_Example/.idea/workspace.xml b/JDBC_Example/.idea/workspace.xml index c4cc345..3e40e22 100644 --- a/JDBC_Example/.idea/workspace.xml +++ b/JDBC_Example/.idea/workspace.xml @@ -15,11 +15,9 @@ - - - - - + + + @@ -279,9 +277,7 @@ - - - + @@ -289,9 +285,7 @@ - - - + @@ -299,19 +293,15 @@ - - - + - - - - - + + + diff --git a/JDBC_Example/out/production/JDBC_Example/com/papei/database/Main.class b/JDBC_Example/out/production/JDBC_Example/com/papei/database/Main.class index 1c91676..d331416 100644 Binary files a/JDBC_Example/out/production/JDBC_Example/com/papei/database/Main.class and b/JDBC_Example/out/production/JDBC_Example/com/papei/database/Main.class differ diff --git a/JDBC_Example/src/com/papei/database/Main.java b/JDBC_Example/src/com/papei/database/Main.java index 16ff0ef..f8a3511 100644 --- a/JDBC_Example/src/com/papei/database/Main.java +++ b/JDBC_Example/src/com/papei/database/Main.java @@ -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)