Posts

Showing posts with the label NVL()

IS NULL, IS NOT NULL, NVL(), NVL2(), COALESCE(), Order By,Group by (), Having()

  Is null, is not null Ø   Select * from emp where comm is null; Ø   Select * from emp where comm is not null; NVL function It   is used to convert null values to given values Ø   Select sal, comm, nvl (comm,0) comm1, sal+nvl (comm,0) net_amount from emp;   NVL2 function nvl(exp1, exp2, exp3) if exp1 is null it written exp3 , otherwise it written exp2. Ø   Select nvl2(comm,100,200) from emp;   ->Select NULLIF (100,200) from dual; it written result as 100 ->Select NULLIF (100,100) from dual; it written result as NULL COALESCE(exp1, exp2, exp3………) ->It written 1 st non null value in the result Ø   Select COALESCE (comm, empno, sal) from emp; Order by ->It can be last of sql statements Ø   Select * from emp order by sal;  for descending order Ø   Select * from emp order by sal desc; for descending order Group by ->It divided into groups , by using this all group function wil...