Sunday, October 6, 2013

Distict KeyWord

Distict KeyWord

It is used to eliminate duplicate values in the output of select statement.

the role for using distinct keyword is the keyword distinct can be used only once that also immediately next to the keyword select


Tables Dept table



Emp table






Display the list of department no in which employees are working

Select distinct deptno from emp

Display the list of jobs available in every Dept 
select distinct deptno,job from emp order by deptno

When you select multiple columns while using the keyword distinct then duplicates will not be eliminated in individual columns and duplicates will be eliminated in the combination of columns you select.

Eg: select distinct job from emp

select distinct deptno,job from emp


No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...