import java.sql.*; class colerase { public static void main(String[] args) throws SQLException { // declare a connection by using Connection interface Connection connection = null; String connectionURL = "jdbc:mysql://192.168.10.13:3306/ankdb"; //declare a resultSet ResultSet rs = null; // Declare statement. Statement statement = null; try { // Load JDBC driver "com.mysql.jdbc.Driver". Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "root", "root"); statement = connection.createStatement(); /* sql query find the element from the table havinf minimum ID */ rs = statement.executeQuery("select min(id) from cellular"); rs.next(); // This sql query delete the row having minimum ID. statement.executeUpdate("delete from cellular where id='"+rs.getInt(1)+"'"); System.out.println("Row is deleted successfully."); // This sql query delete the column name of specified name. statement.executeUpdate("ALTER TABLE cellular DROP name"); System.out.println("column 'Address' is deleted successfully."); } // catch exceptions if found any exception at run time. catch(Exception ex){ System.out.println("Sorry ! found some problems with database."); System.out.println("Error is : "+ ex); } finally { // close all the connections. rs.close(); statement.close(); connection.close(); } } }