hai, i m new to this site and my 1st post is this. I have a table which consist of some tuples. i didnt set any primary key. by mistakely i entered the same values for two tuples. i want to delete a single tuple without copying the table to another new table or using DISTINCT keyword... how its possible. My professor told there is an way... and ask me to find out. CAN anyone help me? thanks in advance....CLEAR MY DOUBT IF U GENIUS
karan_21584 0 Light Poster
Recommended Answers
Jump to PostYou could use the rowid, it's probably the simplest solution. For info the rowid will uniquely identify a row within a table. It is a virtual column that Oracle maintains for all tables. Other than for situations where no primary or unique exists it shouldn't be relied upon too heavily …
Jump to PostAnother approach would be :
delete from TABLE_NAME T where rowid not in (select max(rowid) from TABLE_NAME R where R.common_column = T.common_column;) ;
Here common_column is the criteria for filtering out duplicates.
Jump to PostTechnically though if 3 copies of a single row existed you would only delete 1 with that script, hence why I used the 1 to keep instead of 1 to delete
Nope. Take a look at it once again. I delete those tuples who don't satisfy the criteria of having …
All 9 Replies
davidcairns 1 Junior Poster
Memento commented: Right on the money +1
karan_21584 0 Light Poster
Memento 2 Light Poster
davidcairns 1 Junior Poster
Memento 2 Light Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
davidcairns 1 Junior Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
davidcairns 1 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.