Creating and Modifying Database Objects

5.5. Creating and Modifying Database Objects

To create, modify or drop a database object like a table or view you use the execute() method. execute is similar to the executeQuery() used to issue a select, however it doesn't return a result.

Example 5-3. Drop Table Example

This example will drop a table.

Statement st = db.createStatement();
ResultSet rs = st.executeQuery("DROP TABLE mytable");
st.close();

Home
Online Resources
General
Beginner Tutorials
MySQL
PostgreSQL
Oracle
mSQL
Microsoft SQL
Contact Us
Random quote of the moment:
Why is it that we rejoice at a birth and grieve at a funeral? It is because we are not the person involved. -- Mark Twain, "Pudd'nhead Wilson's Calendar"
 
http://www.sql.org/
 
Proudly designed and hosted by OmegaSphere, providers of all your Web Hosting, SSL Certificate, and Domain Name needs!