To delete records in a table in DB2 database DELETE command is used, this command is well known in other databases and their use is similar in DB2.


As shown in the above syntax, the DELETE command only needs to receive as parameter the name of the table, but there is a very important item to be considered. When using the command as shown before all records are deleted and in many cases this format does not apply, due the WHERE clause is used with it.

DELETE FROM [Table] WHERE [Conditional]

In the syntax shown earlier, only records that satisfy the conditional will be deleted. As a practical example we will delete products from a table using both formats.


DELETE FROM product WHERE cod_prod = 1

n the first example all products will be deleted from the table, in the second only the product that has the code 1 will be deleted.


DB2 has gained more space in web development environments and because it understand it works becomes a great advantage. So, discover the advantages of working with DB2 on PHP projects on our official site.

You might also like…

Scriptcase uses the MVC template?

Maybe you might have thought about this at some point, “Scriptcase uses the MVC templates?" Well, ...

How to implement A2F using Own Development in NodeJS in a Scriptcase application

A2F using Own Development in NodeJS A2F: In a previous article, we talked about Swivel as an extern...

Specialists or generalists, who gets a better advantage by using Scriptcase?

Hey there! Today  we will figure what are the ideal profiles for those who wish to take advantage o...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.