Saturday, April 12, 2014

T SQL Tutorial: UPDATE


Learn how to use the T SQL DELETE statement with syntax, examples, and practice exercises.

Description
The T SQL DELETE statement is a used to delete a one or more records from a table.

Syntax
The syntax for the T SQL DELETE statement is:

DELETE FROM table
WHERE conditions;

You do not need to list fields in the T SQL DELETE statement since you are deleting the entire row from the table.
Delete With One condition

Let's look at an example showing how to use the T SQL DELETE statement.
For example:

DELETE FROM customer
WHERE customer_name = 'Rohit';
This T SQL DELETE example would delete all records from the suppliers table where the Customer_name is rohit.

Delete With Two conditions
Let's look at a T SQL DELETE example, where we just have two conditions in the T SQL DELETE statement.

For example:

DELETE FROM order
WHERE price >= 20
AND custid = 222;

This T SQL DELETE example would delete all records from the products table where the price is greater than or equal to 20 and the custid is 222.

 

No comments:

Post a Comment