Delete a Column from a Database Table : Table « Database « Java Tutorial






import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class Main {
  public static void main(String[] argv) throws Exception {
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbctutorial",
        "root", "root");

    Statement st = con.createStatement();
    st.executeUpdate("ALTER TABLE mytable DROP col");
    System.out.println("Column is deleted successfully!");
  }
}








20.26.Table
20.26.1.Create a table in database
20.26.2.Delete record from table
20.26.3.Description of Database Table
20.26.4.Adding a New Column Name in Database Table
20.26.5.Change Column Name of a Table
20.26.6.Make Unique Column in Database Table
20.26.7.Remove Unique Column in Database Table
20.26.8.Arrange a Column of Database Table
20.26.9.Sum of Column in a Database Table
20.26.10.Delete a Column from a Database Table
20.26.11.Copy data from one table to another in a database
20.26.12.Drop table from database
20.26.13.Copy One Database Table to Another