sql - How to delete completely duplicate rows -
Say that there are duplicate rows in my table and well my database design is of third grade: -
tblProduct (product id, product name, description, category) value (1) Insert 'synthetic', 'cosmetic soap', 'soap'); Enter TblProduct (product, product, name, description, category) values (1, 'synthol', 'cosmetic soap', 'soap'); Enter TblProduct (product, product, name, description, category) values (1, 'synthol', 'cosmetic soap', 'soap'); Insert TblProduct (product, product, name, description, category) values (1, 'Lux', 'cosmetic soap', 'soap'); Insert TblProduct (product, product, name, description, category) values (1, 'Crowning Glory', 'Cosmetic Soap', 'Soap'); Enter TblProduct (product, product, name, description, category) values (2, 'Synthol', 'Good soap', 'Soap'); Insert TblProduct (product, product, name, description, category) values (3, 'Lux', 'good soap', 'soap'); Insert TblProduct (product, product, name, description, category) values (3, 'Lux', 'good soap', 'soap');
I want my table to contain only one instance of each row. Thus, the
2, 3, and the last line
whcih should be completely removed as well. Which query can I write for? Can this be done without creating temporary tables? Just in the same question?Thank you in advance :)
Try it - it's all duplicates from your table Removal of: Duplicate with duplicate (SELECT ProductID, ProductName, Description, Category, ROW_NUMBER), Product from productive product name, from 'RONAMA' Dbo.tblProduct) with duplicate where Roam & Gt; Select 1GO * FROM dbo.tblProduct GO
Your duplicate should now go: Output is:
ProductID ProductName DESCRIPTION Category 1 Synthol Cosmetic Soap Soap 1 Lux Cosmetic Soap Soap 1 Crowning Glory Cosmetic Soap Soap 2 Senthol Good Soap Soap 3 Lux Good Soap Soap