Eastern challenge

I just wanted to give to my readers a bit fun for Eastern…

Using the well known EMP table, retrieve the name of the job that is the less common…

The solution must be a one-liner SELECT statement (max 80 chars) :)

Have fun!

14 thoughts on “Eastern challenge”

  1. well done all!
    I first add Sten solution in mind, but Colin first solution could be a 77
    SELECT*FROM(SELECT job FROM emp GROUP BY job ORDER BY COUNT(*))WHERE ROWNUM=1

    and Colin first_value could be a 78 by adding unique
    SELECT unique FIRST_VALUE(job)OVER(ORDER BY COUNT(*))FROM lsc_emp GROUP BY job

    (unique is a rare synonym of distinct, but shorter to type :) )

  2. nice and great fun !

    but the question is wrong (at least, there is something missing):
    what, if there is more than one jobs that are ‘the less common’ ?

    sokrates > select job from emp;

    JOB
    ———
    bunny
    bunny
    easter
    easter

    4 rows selected.

    which of them should the query return ?
    all ?
    a randomly chosen ?
    none ?

    happy easterday to you !

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>