Deleting of data: – SQL also provide to delete one or more rows using DML. Deletion is complete the data manipulation operation for handling the data base. User can delete rows from existing table with or without condition. If it is used without any condition, all rows are deleted from existing table. If this statement is used with some condition, only selected rows are deleted from the existing table. Syntax of the delete statement is –

                Delete <Table Name> (Where <Test Expression>);

Some example of delete statements are as fallows –

                Delete employee;

The above statement delete all rows from existing table employee.

                Delete employee where city=’Chennai’;

In case of above example, only those rows are deleted from table employee witch city=’Chennai’.

                Delete company where ename in (select ename from employee where city=’Mumbai’);

In case of above example, only those rows deleted from table company which ename in table employee is same and city is Mumbai.

Advertisements