DISTINCT - Supressing Duplicate Rows in Output

Supressing Duplicate Rows : =
  • Sometimes, your query results contain duplicate rows. You can eliminate such rows by adding the keyword DISTINCT immediately after the keyword SELECT.
  • Multiple columns can be declared after the DISTINCT qualifier.
  • The DISTINCT qualifier affects all the selected columns, and represents a DISTINCT combination of the columns.
  • When DISTINCT is implemented upon a column which may contain NULL values, all the NULLS in the column together treated as one DISTINCT group.
  • A select statement should have one DISTINCT keyword.

Examples :=
    
     Ø  Select DISTINCT deptno from emp;
     
     Ø  Select DISTINCT deptno,mgr from emp;

  Ø  Select DISTINCT deptno,job from emp;
      

No comments:

Post a Comment

Infolinks In Text Ads