
How to use the SQL DELETE Statement
How to use the SQL DELETE Statement
Learn how to use the SQL DELETE Statement. This tutorial demonstrates how to write a DELETE query with an easy to follow example.
SQL DELETE Statement (and sample data):
https://www.techonthenet.com/sql/dele…
SQL Tutorials:
https://www.techonthenet.com/sql/inde…
Don’t forget to subscribe to our channel for more great SQL tutorials!
Visit us at: https://www.techonthenet.com
or follow us on:
Facebook: https://www.facebook.com/techonthenetcom
Twitter: https://twitter.com/tech_on_the_net
Pinterest: https://www.pinterest.com/techonthene…
Content
0.02 -> The DELETE statement
(or commonly referred to as the "DELETE query")
4.12 -> is the SQL statement that is used to delete one
or more records from a table in your database
9.96 -> The best way to understand the
DELETE statement is to look at an example
14.28 -> So let's get started
16.16 -> Here we have a table called suppliers
containing the following data
22 -> Let's write a DELETE statement
that removes all suppliers
25.36 -> where the supplier_name
is equal to "Microsoft"
29.86 -> We'll start our DELETE statement by
entering the DELETE keyword
35.22 -> This lets the database know that we want to write
a DELETE query and remove records from the database
41.12 -> Next, we need to enter
the FROM clause
44.44 -> The FROM clause lets the database know
which table to delete data from
49.4 -> In this example, we'll enter suppliers as our table
53.08 -> Now the query knows to
delete records from the suppliers table
58.72 -> The WHERE clause is optional
61.58 -> It is used to specify conditions that must
be met for the records to be deleted
67.08 -> If no conditions are provided,
then all records in the table will be deleted
72.3 -> Since we want to delete only those records where
the supplier_name is equal to "Microsoft"
77.049 -> we will enter our WHERE clause
as follows:
80.46 -> Notice that "Microsoft" must be enclosed
in quotes since it is a string value
86.84 -> Now let's run our DELETE statement
and see what results we get
91.32 -> In this example, the database will return a message
to let us know that one record has been deleted
96.66 -> and if we look at the suppliers table,
we should see that the record
101.08 -> where the supplier_name is equal to "Microsoft"
has been removed from the table
105.88 -> This covers a simple example of
how to use the SQL DELETE statement
109.98 -> if you would like to see
more DELETE examples
112.72 -> or would like to download
the sample data we used for this tutorial
115.84 -> please visit our website at
TechOnTheNet.com
118.98 -> You can also try the examples
in our SQL editor on our website
123.5 -> Look for the "Try It" button next
to each example
127.3 -> If you found our tutorial helpful,
please leave a like on this video
130.82 -> and don't forget to subscribe
to our YouTube channel for more great SQL tutorials
Source: https://www.youtube.com/watch?v=VKlNt3pkLaw