Difference between revisions of "Oracle:DELETE"
From mi-linux
Jump to navigationJump to searchLine 25: | Line 25: | ||
COMMIT; | COMMIT; | ||
− | == Exercise | + | == Exercise 3.3 == |
− | + | 3.3.1 Why do we need to specify a number as well as the name when deleting the record? | |
− | + | 3.3.2 Could the WHERE statement be shortened? | |
− | + | 3.3.3 What command verifies the record has been deleted? | |
The system should respond with the message: | The system should respond with the message: |
Revision as of 17:05, 22 February 2016
Main Page >> Oracle and SQL >> Workbook >> DML >> Deleting records
DELETE Command
The format of the SQL - DELETE statement is:
- DELETE FROM TableName
- [WHERE FilterCondition1
- [AND | OR FilterCondition2 ...]]
Where:
- FROM TableName Specifies the table in which records are deleted from.
- WHERE FilterCondition1 [AND | OR FilterCondition2 ...] FilterCondition specifies the criteria that records must meet to be deleted.
You can include as many filter conditions as you like, connecting them with the AND or OR operator.
You can also use the NOT operator to reverse the value of a logical expression, or use IS NULL to check for an empty field.
Our new employee KING has decided to leave, to remove the record from the EMP table type:
DELETE FROM EMP WHERE ENAME = 'KING' AND EMPNO = 7945; COMMIT;
Exercise 3.3
3.3.1 Why do we need to specify a number as well as the name when deleting the record?
3.3.2 Could the WHERE statement be shortened?
3.3.3 What command verifies the record has been deleted?
The system should respond with the message:
- no rows selected