Interview Answer

Computer system analysis is like child-rearing; you can do grievous damage, but you cannot ensure success. Tom DeMarco

find duplicate records with the number they are duplicated?

January 1, 1970 12:00 am

Comments



find duplicate records with the number they are duplicated?



												desc HR.employees;
												
												Name           Null     Type         
												-------------- -------- ------------ 
												EMPLOYEE_ID    NOT NULL NUMBER(6)    
												FIRST_NAME              VARCHAR2(20) 
												LAST_NAME      NOT NULL VARCHAR2(25) 
												EMAIL          NOT NULL VARCHAR2(25) 
												PHONE_NUMBER            VARCHAR2(20) 
												HIRE_DATE      NOT NULL DATE         
												JOB_ID         NOT NULL VARCHAR2(10) 
												SALARY                  NUMBER(8,2)  
												COMMISSION_PCT          NUMBER(2,2)  
												MANAGER_ID              NUMBER(6)    
												DEPARTMENT_ID           NUMBER(4)   
												

Solution

   					 
												SELECT employee_id, count (*) as num_records
													from  HR.employees  
													group by employee_id  
													having count (*) > 1;
																    

Comments



Please login to add comments.