| |
GeekInterview.com > Interview Questions > Oracle > SQL Plus
| Print | |
Question: How many ways you can delete the table records ?
Answer: In how many ways can I delete all the contents of a table and the entire table. Explain with syntax ? |
| July 07, 2008 11:20:29 |
#1 |
| manipr |
Member Since: June 2008 Total Comments: 1 |
RE: How many ways you can delete the table records ? |
To delete the records in a table , there are 2 ways . 1.Using the delete statement 2.using the truncate statement . To delete the entire table drop statement is used .
Deleting a record from a table : use the following statement. delete from table_name where column_name = some_value; . The above statement deletes a single record at a time.
To delete all the records in a table the following statement is used. delete * from table_name;
coming to the truncate statement , its like a delete statement without a where clause. the syntax is Truncate table table_name. It also removes all the records in the table. In case of delete * from table_name and truncate table table_name all the records in the table is deleted but the table structure and its columns , constraints , indexes remain the same .
To remove the table from the database,use the drop table statement. drop table table_name;
|
| |
Back To Question | |