you do not have the tables but what is required is the code you might not see the ou 4947470

You do not have the tables, but what is required is the code.You might not see the output. Show how to retrieve a data in yourcode based on the starter code and the output given. If you useprintf to display each query you will run into an interesting(quirky?) problem – printf assumes that every % indicates some typeof formatting. Our first query ends with “…LIKE ‘D%’”. If you tryto print this using printf you will get an error. The “best”solution to this is to use print or println instead of printf –neither print nor println use the % as a formatting command. Astarter code is given below:
You will move the database access code to a separatemethod which will be called by main. When calling this method youwill pass in two strings – one contains information about the queryto be displayed with the output, the other containing the SQL queryto be executed.
Starter code //DisplayAuthors.java

//Displaying the contents of the Authors table.

import java.sql.Connection;

import java.sql.Statement;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import java.sql.SQLException; public class DisplayAuthors {    public static void main(String[] args) {

          

       final String DATABASE_URL =”jdbc:derby:books”;

       final String SELECT_QUERY =

             

              “SELECT firstName, lastName FROM Authors”;

             

                        

      

       // use try-with-resources toconnect to and query the database

       try (

              Connection connection =DriverManager.getConnection(

                     DATABASE_URL, “deitel”, “deitel”);

              Statement statement =connection.createStatement();

              ResultSet resultSet =statement.executeQuery(SELECT_QUERY))

          

             

       {

          

       // get ResultSet’s metadata  

       ResultSetMetaData metaData =resultSet.getMetaData();

       int numberOfColumns =metaData.getColumnCount();

      

       System.out.printf(“Authors Table ofBooks Database:%n%n”);  

  

       // display the names of the columnsin the ResultSet

       for (int i = 1; i

          System.out.printf(“%-8st”, metaData.getColumnName(i));

       System.out.println();

      

       // display query results

       while (resultSet.next())

       {

           for (int i = 1;i

              System.out.printf(“%-8st”,resultSet.getObject(i));

          System.out.println();

       }

   }// AutoCloseable objects’ close methods are callednow

  

   catch (SQLException sqlException)

   {

      sqlException.printStackTrace();

   } } }
Sample Output Figure 24.13: SELECT AuthorID, FirstName, LastName FROM AuthorsWHERE LastName LIKE ‘D%’ AUTHORID        FIRSTNAME LASTNAME 1             Paul   Deitel ⁞               ⁞                      ⁞ Figure 24.15: SELECT AuthorID, FirstName, LastName FROM AuthorsORDER BY LastName ASC AUTHORID        FIRSTNAME LASTNAME 3             Abbey            Deitel ⁞               ⁞                      ⁞ Figure 24.16: SELECT AuthorID, FirstName, LastName FROM AuthorsORDER BY LastName DESC AUTHORID        FIRSTNAME LASTNAME 4             Dan    Quirk ⁞               ⁞                      ⁞ Figure 24.19: SELECT FirstName, LastName, ISBN FROM AuthorsINNER JOIN AuthorISBN ON Authors.AuthorID = AuthorISBN.AuthorIDORDER BY LastName, FirstName FIRSTNAME      LASTNAME    ISBN Abbey      Deitel 0132121360 ⁞               ⁞                      ⁞ Figure 24.23: SELECT AuthorID, FirstName, LastName FROMAuthors AUTHORID        FIRSTNAME LASTNAME 1             Paul   Deitel ⁞               ⁞                      ⁞ Attached

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now