Database Reference
In-Depth Information
update MySqlTable
set Name = 'Sparkly',
SSN = '444-50-9100'
where Id = 4
If you execute Select * from MySqlTable , you would see that the Name and SSN values for person
have changed, as shown in Figure 4-6.
Figure 4-6. SELECT statement showing modified row after UPDATE statement for multiple columns
Deleting Data
To remove data, you use the DELETE statement. The DELETE statement has the same implications as the
UPDATE statement. It's all too easy to delete every row (not just the wrong rows) in a table by forgetting
the WHERE clause, so be careful. The DELETE statement removes entire rows, so it's not necessary (or
possible) to specify columns. Its basic syntax is as follows (remember, the WHERE clause is optional, but
without it, all rows will be deleted):
DELETE FROM <table>
WHERE <predicate>
If you need to remove a record or set of records from the MySqlTable table, then you need to
determine the records you want to delete with some unique value like an identity key or primary key,
and then you specify this unique value of the row you want to remove with the WHERE condition of the
DELETE statement.
 
Search WWH ::




Custom Search