Monday, August 17, 2009

Fundamental Forces and their Force Carrying Particles


Difference Between Interface and Abstract Class

Interfaces
--contain only abstract methods
--interface can't be inherited from a class
--using interfaces we can achieve multiple inheritance
--doesn't allow accessibility modifiers (Public/Private/Internal)
--can't contain fields, constructors
--is must implementable & its scope is upto any level of its inheritence chain.

Abstract Class
--contain both abstract methods as well as concrete methods
--can extend another class and implement multiple interfaces
--we can't achieve multiple inheritance
--allows accessibility modifiers
--can contain fields, constructors
--class Abstract class is must inheritable & its scope is upto derived class

Saturday, August 15, 2009

How To: Delete Duplicate Rows from a Table


Problem: You have a table (table1) & values as above, and it contains the duplicate records as shown, how will you delete the duplicates?

Solution: Use following query, the records shown in the below image will be deleted
delete from table1 where empid not in
(select max(empid) from table1 group by empName,empEmail,empCity);