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.

DELETE FROM [Table]

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

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.

ibm-db2

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…

PROCESAMIENTO AJAX EN SCRIPTCASE

Ajax en los formularios de Scriptcase puede usarse para recargar un campo de tipo de select basado e...

IMPORTAR IMAGENES DE LA BASE DE DATOS Y UTILIZAR CLASES DE BOOSTRAP

Como muchas personas ya saben, Bootstrap es una biblioteca de front-end libre y de código abierto p...

TENDENCIAS DE DESARROLLO WEB PARA 2017

Usted verá en este post tendencias para 2017 en Diseño Web, en el medio digital y en el desarrollo...

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 sales@scriptcase.net. Learn more about our Privacy Police.