Write a Java Program to delete details of students whose initial character of their name is ‘S’.

Write a Java Program to delete details of students whose initial character of their name is ‘S’.

 import java.sql.*;

class Slip4a {

 

    public static void main(String args[]) throws Exception {

        Connection con;

        Statement stmt;

        Class.forName("com.mysql.jdbc.Driver");

 

         con =  DriverManager.getConnection("jdbc:mysql://localhost:3306/college", "root", "");

 

        stmt = con.createStatement();

        int n = stmt.executeUpdate("delete from student where sname like 'S%'");

        System.out.println(n + " rows deleted..");

        con.close();

    }

}