Answer» | execute() | executeQuery() | EXECUTEUPDATE() |
|---|
| It can be used for any SQL statements. | It is used to execute SQL Select queries. | It is used to execute the SQL statements such as Insert/Update/Delete which will update or modify the database data. | | It returns the boolean value TRUE if the RESULT is a ResultSet object and FALSE when there is no ResultSet object. | It returns the ResultSet object which contains the data retrieved by the SELECT statement. | It returns an INTEGER value which represents the number of affected rows where 0 indicates that the query returns null. | | Used for executing both SELECT and non-SELECT queries. | Used for executing only the SELECT Query. | Used for executing only a non-SELECT query. |
The execute() method is used in the situations when you are not sure about the type of statement else you can use executeQuery() or executeUpdate() method.
|