Database Reference
In-Depth Information
delete from MySqlTable
where Id = 2
This should produce a Messages pane reporting “(1 row(s) affected).” Execute the
Select * from
MySqlTable
statement, and you'll see that the row with an ID of 2 has been removed, as shown in
Figure 4-7.
Figure 4-7.
SELECT statement showing rows after the DELETE statement
Again, it's important to use the
WHERE
clause with the
DELETE
statement; if you specify a
DELETE
statement without it, then you will delete all the rows of the specified table.
Summary
In this chapter, you learned how to use the following T-SQL keywords to perform data manipulation
tasks against a database:
INSERT
,
UPDATE
, and
DELETE
.
In the next chapter, you will learn how to query a database.