GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL Plus
Go To First  |  Previous Question  |  Next Question 
 SQL Plus  |  Question 130 of 132    Print  
How many ways you can delete the table records ?
In how many ways can I delete all the contents of a table and the entire table. Explain with syntax ?


  
Total Answers and Comments: 2 Last Update: December 19, 2008     Asked by: g.ashok1988 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: manipr
 
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;



Above answer was rated as good by the following members:
anjaliraj, badhan
July 17, 2008 11:20:29   #1  
manipr Member Since: June 2008   Contribution: 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;


 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
December 19, 2008 00:35:17   #2  
praveen_appu47 Member Since: December 2008   Contribution: 1    

RE: How many ways you can delete the table records ?
There are two ways To delete all records in the table.
1. using delete
2. using truncate
In delete option we have used drop command. eg. drop table table_name;
for second one eg. truncate tablename; Both are delete the records in a table.

 
Is this answer useful? Yes | No

 Related Questions

Answer posted by Scott on 2005-05-25 18:30:04: TRUNCATE is a DDL command and cannot be rolled back. All of the memory space is released back to the server. DELETE is a DML command and can be rolled 
Latest Answer : DELETE is a logged operation on a per row basis.  This means that the deletion of each row gets logged and physically deleted. You can DELETE any row that will not violate a constraint, while leaving the foreign key or any other contraint in place. ...

Latest Answer : Quote  A ROWID is created by Oracle for each new row in every table, it is a pseudo column that has a value for every row in a table. The ROWID gives us the physical address of a row and is the fastest way to access any row. The ROWID contains 3 ...

Latest Answer : ON DELETE CASCADE option permits deletions of referenced key values in the parent table and automatically deletes dependent rows in the child table to maintain referential integrity. ...

Latest Answer : binaryBigintbitChardatetimedecimalFloatimageIntMoneyncharNtextnvarcharNumericRealsmalldatetimesmallintsmallmoneysql_variantsysnametexttimestamptinyintvarbinaryvarcharuniqueidentifierthese are the data types used in sql table ...

Latest Answer : Only one column can have LONG data type. And that column cannot be used in WHERE clause or in ORDER BY clause. Also we cannot add primary key constraint to that column only not to the whole table, that means we will give primary key to any column in the ...

Answered by Scott on 2005-05-12 10:18:34: Constraints are found under the USER_CONSTRAINTS table. 
Latest Answer : Correction to some answers aboveUser_Constraints is a view and not a table ...

Latest Answer :  if a view based on one table or multiple table matter is it should contain all not null columns and additionaly no calculated column then ant DML statement will cause changes in base table. ...

Latest Answer : Select ROWNUM, col1, col2 from tablename; ...

Display the records between two range I know the nvl function only allows the same data type(ie. number or char or date Nvl(comm, 0)), if commission is null then the text “Not Applicable” want to display, instead of blank space. How do I write the query

Latest Answer : select * from employee where 1=(select count(*) from employee as e where employee.sal


 Sponsored Links

 
Related Articles

Querying Data with Oracle XQuery

Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2 you can take advantage of a full featured native XQuery engine integrated with the database With Oracle XQuery you can accomplish various tasks involved in developing PHP Oracle XML applications operating on any kind of dat
 

Using Oracle XML DB Repository

Using Oracle XML DB Repository Another variation on accessing and manipulating XML content stored in Oracle database is provided by Oracle XML DB repository which is an essential component of Oracle XML DB mosgoogle NOTE Oracle XML DB repository also known as XML repository is a hierarchically organ
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

XML Processing in PHP and Oracle Applications

Processing XML in PHP Oracle Applications As mentioned there are two alternatives when it comes to performing XML processing in your PHP Oracle application You can perform any required XML processing using either PHP s XML extensions or PEAR XML packages or Oracle s XML features mosgoogle In the fol
 

PHP Oracle Web Development

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax is a good starting b
 

ODP.NET - Populating a Dataset with a Single Data Table

ODP NET Populating a Dataset with a Single Data Table A dataset is simply a group of data tables These data tables can be identified with their own unique names within a dataset You can also add relations between data tables available in a dataset mosgoogle The following code gives you the details o
 

Getting Started with Oracle and ODP.NET

ODP NET Developer’ s Guide by Jagadish Chatarji Pulakhandam Sunitha Paruchuri A practical guide for developers working with the Oracle Data Provider for NET and the Oracle Developer Tools for Visual Studio 2005 Application development with ODP NET Dealing with XML DB using ODP NET Oracle
 

PHP Oracle Web Development Review

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books The author is also an expert in open source technologies and SOA Service Oriented Architecture But besides
 

jQuery Table Row Finished Code

jQuery Table Row Finished Code The Finished Code Our second example page has demonstrated table row striping highlighting tooltips collapsing expanding and filtering Taken together the JavaScript code for this page is mosgoogle geshibot lang php" document ready function var highlighted
 

jQuery Expanding and Collapsing Table Rows

jQuery Expanding and Collapsing Table Rows The expanding and collapsing behavior added earlier also conflicts with our filters If a section is collapsed and a new filter is chosen then the matching items are displayed even if in the collapsed section Conversely if the table is filtered and a section
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape