The delete statement delete the single row as well as multiple rows from the table.
Syntax:
Deleting all rows:
DELETE FROM Table_name;
Here delete is the keyword and from specify the table in which we are going to delete the data and table_name specify the name of the table.in this delete statement we can add a where clause to delete rows according to some condition we can specify the where clause in the end of the statement.
Deleting selected rows:
DELETE FROM Table_name WHERE condition;
Example:
Delete all the employee whose department_id is 50
delete from employee2
where dept_id=50
Delete all the employee
delete from employee2
The first statement delete only two rows i,e emp_id 198,199 rows will be deleted after processing this statement by oracle server where as the second statement delete all the rows from the employee2 table .So be carefull when you are writting any delete statement .For safety create a savepoint then perform the any delete operation so that u can rollback your data .we will learn about savepoint and rollback in coming lession .
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter
Syntax:
Deleting all rows:
DELETE FROM Table_name;
Here delete is the keyword and from specify the table in which we are going to delete the data and table_name specify the name of the table.in this delete statement we can add a where clause to delete rows according to some condition we can specify the where clause in the end of the statement.
Deleting selected rows:
DELETE FROM Table_name WHERE condition;
Example:
Delete all the employee whose department_id is 50
delete from employee2
where dept_id=50
Delete all the employee
delete from employee2
The first statement delete only two rows i,e emp_id 198,199 rows will be deleted after processing this statement by oracle server where as the second statement delete all the rows from the employee2 table .So be carefull when you are writting any delete statement .For safety create a savepoint then perform the any delete operation so that u can rollback your data .we will learn about savepoint and rollback in coming lession .
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter
No comments:
Post a Comment