We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. SQL
  3. Advanced Select
  4. The PADS
  5. Discussions

The PADS

Problem
Submissions
Leaderboard
Discussions

Sort 4203 Discussions, By:

recency

Please Login in order to post a comment

  • md_washeal
    12 hours ago+ 0 comments

    Not Working For (ORACLE): SELECT (NAME ||'('|| SUBSTR(OCCUPATION,1,1)|| ')' AS HEADLINE FROM OCCUPATIONS ORDER BY NAME;

    SELECT 'There are a total of ' || COUNT(OCCUPATION) || ' ' || INITCAP(OCCUPATION) || 's' AS MESSAGE FROM OCCUPATIONS GROUP BY OCCUPATION ORDER BY COUNT(OCCUPATION);

    0|
    Permalink
  • vaibhavjpreache1
    16 hours ago+ 0 comments

    For sql server: Select concat(Name,'(',left(Occupation,1),')') from Occupations order by Name; declare @message varchar(50); set @message = 'There are a total of';

    Select concat(@message,' ',count(Occupation),' ',lower(Occupation),'s.') from Occupations group by Occupation order by count(Occupation),Occupation Asc;

    0|
    Permalink
  • legendsultra470
    1 day ago+ 2 comments

    SELECT CONCAT ("There are total ", COUNT (OCCUPATION), " ", LOWER (OCCUPATION), "s.") FROM OCCUPATIONS GROUP BY OCCUPATION ORDER BY COUNT (OCCUPATION), OCCUPATION; can anybody point out the mistake

    0|
    Permalink
  • TuanBao
    2 days ago+ 0 comments

    This is my MySQL solution, feel free to ask me any questions.

    -- The first query
    SELECT CONCAT(NAME, '(', LEFT(OCCUPATION, 1), ')' )
           AS HEADLINE
    FROM OCCUPATIONS
    ORDER BY NAME ASC;
    
    -- Prepare constantS
    SET @MESSAGE = 'There are a total of ';
    
    -- The second query
    SELECT CONCAT(@MESSAGE, COUNT(OCCUPATION), ' ', 
                  LOWER(OCCUPATION), 's.') 
    FROM OCCUPATIONS
    GROUP BY OCCUPATION
    ORDER BY COUNT(OCCUPATION);
    
    1|
    Permalink
  • ameerpotganti1
    2 days ago+ 0 comments

    FOR ORACLE SQL CODE

    select name || '('||SUBSTR(OCCUPATION,0,1)||')' from occupations ORDER BY NAME; select 'There are a total of ' || count(occupation) || ' ' || LOWER(OCCUPATION)||'s'||'.' from occupations group by occupation order by count(occupation), occupation;

    0|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy