Java Reference
In-Depth Information
The following UPDATE statement changes two columns in the row of
employee 102:
UPDATE Employees SET payRate=10.00, first='Richard' WHERE number=102
Deleting Data
The DELETE statement is used to delete rows from a database. The DELETE
has the syntax:
DELETE FROM table_name
WHERE conditions
The following statement deletes the row from the Employees database
whose number column is 101:
DELETE FROM Employees WHERE number=101
The following DELETE statement deletes all employees whose first name
starts with Rich:
DELETE FROM Employees WHERE first LIKE 'Rich%'
You can delete a table from a database using the DROP TABLE statement,
which looks similar to:
DROP TABLE table_name
For example, the following statement removes the Employees table from the
database:
DROP TABLE Employees
Creating Statements
After you connect to a database using either the DriverManager class or the
DataSource class, you get a java.sql.Connection object. The Connection class
contains the methods you need for creating SQL statements. The java.sql.State-
ment interface represents a SQL statement, and there are three types of State-
ment objects:
Search WWH ::




Custom Search