We can update a table using following statements. update tablename set columnname=somevalue; Or update tablename set columnname=somevalue where conditions; To update all the records use the first statement. To update particular records, add where conditions at the end of the update statements. To give an increment of 1000 to all our employees use: update employee set salary=salary+1000; update employee set salary=60000 where empid=1; The above statement will change the salary of employee with empid 1 to 60000. Deleting Data Data from tables can be deleted using the following statements. delete from tablename; delete from tablename where conditions; delete tablename; delete tablename where conditions; To delete the record of an employee with the first name Tim use: delete from employee where "First Name"='Tim'; To delete all records from the employee table use: delete employee; Dropping a Table To drop a table use: drop table tablename; To drop an employee table use: drop table employee;
To commit changes in Oracle Database use commit and to roll back your changes use the rollback command.
blog comments powered by Disqus |
|
|
|
|
|
|
|