File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQL statment to Delete a row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL statment to Delete a row " Watch "SQL statment to Delete a row " New topic

SQL statment to Delete a row

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Could you please tell me how to delete a row in a database.
I am asking for the SQl statement. for example "INSERt INTO" for inserting values.

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Joe Pluta
Ranch Hand

Joined: Jun 23, 2003
Posts: 1376
The WHERE clause can be as complex as you want. Just be careful; if your WHERE clause is incorrect, you may delete records you did not intend to delete. In fact, if you leave the WHERE clause off completely DELETE will delete all the rows in the table.
Darren Bell

Joined: Aug 01, 2003
Posts: 14
Also, if you are deleting single rows, it's best to use all the primary key fields in the where clause. This gaurantees that only a single row will be deleted.
I agree. Here's the link:
subject: SQL statment to Delete a row
It's not a secret anymore!