DELETE removes rows from tables.

Use DELETE with WHERE to remove all rows that contain a matching field value.

First, let’s see how many rows are in the table:

 

1 SQL> select count(*) from staging.order_item;

Screen Shot 2016-06-06 at 9.14.16 AM

Next, we’ll delete several rows based on the value of order_code:

 

1 SQL> delete from staging.order_item where order_code like ‘ARep%’;

Screen Shot 2016-06-06 at 9.14.25 AM

The command output returns the number of affected rows.

 

Verify the operation by counting the rows that remain:

 

1 SQL> select count(*) from staging.order_item;

Screen Shot 2016-06-06 at 9.14.33 AM

We see that there are 36 fewer rows.