Delete Unnecessary Data

Learn how to delete data from the table.

We’ll do plenty of hands-on exercises on retrieving data stored inside our customers database. Before we proceed, let’s delete the existing data from our database. We’ll then insert data that will be useful later.

Delete data from order_items, orders, and customers.

The following commands will delete all the data except the products. We’ll leave the products as they are:

mysql> delete from order_items;
Query OK, 2 rows affected (0.01 sec)

mysql> delete from orders;
Query OK, 2 rows affected (0.00 sec)

mysql> delete from customers;
Query OK, 2 rows affected (0.00 sec)

Let’s verify these commands by executing them below:

Get hands-on with 1400+ tech skills courses.