Update, Delete, Truncate , Drop

UPDATE

The update statement is used to update or change records that match a specified criteria. This is accomplished by carefully constructing a where clause.

Example

UPDATE EMP SET ENAME = ’HARI’ WHERE ENAME = ‘HARIKUMAR’

UPDATE EMP SET SAL = SAL+500

DELETE

Deleting Records

To delete an entire record/row from a table, enter "delete from" followed by the table name, followed by the where clause which contains the conditions to delete. If you leave off the where clause, all records will be deleted.

Other Example

DELETE FROM EMP WHERE ENAME = ‘BINU’

TRUNCATE

This will delete all the records from table

TRUCATE TABLE EMP


DROP

The drop table command is used to delete a table and all rows in the table.

To delete an entire table including all of its rows, issue the drop table command followed by the tablename. drop table is different from deleting all of the records in the table. Deleting all of the records in the table leaves the table including column and constraint information. Dropping the table removes the table definition as well as all of its rows

[This will remove the table itself.]

DROP TABLE EMP