#22 The PADS | HackerRank SQL Solutions

แชร์
ฝัง

ความคิดเห็น • 20

  • @sid_x_18
    @sid_x_18 ปีที่แล้ว +12

    Those who are watching this now this query won't work as we have to now use UNION between two select statements otherwise second statement's select part will come into output . Also we can only use one order by after using union .
    This is the query that will work--
    select concat(name,'(',left(occupation,1),')') as ZZZ from occupations
    UNION ALL
    select concat('There are a total of ',count(occupation),' ',lower(occupation),'s.') from occupations group by occupation order by ZZZ ;

    • @naumanbabar7240
      @naumanbabar7240 ปีที่แล้ว +2

      SELECT CONCAT(Name,"(", LEFT(Occupation,1),")")
      FROM OCCUPATIONS
      UNION
      SELECT CONCAT("There are a total of ",COUNT(*)," ",LOWER(Occupation),"s.")
      FROM OCCUPATIONS
      GROUP BY Occupation
      ORDER BY 1

    • @ahmed_abdoamin_abdo2844
      @ahmed_abdoamin_abdo2844 ปีที่แล้ว

      @@naumanbabar7240 thank you. it is helpful.

    • @souvikbiswas7042
      @souvikbiswas7042 ปีที่แล้ว

      @@naumanbabar7240 Why did you use Order by 1?

    • @SameerrCoding
      @SameerrCoding ปีที่แล้ว

      It's working brother

    • @surajsidar3280
      @surajsidar3280 6 หลายเดือนก่อน

      whatever solution provided on video is working

  • @ahmetgunay4020
    @ahmetgunay4020 ปีที่แล้ว +1

    select name || '(' || substr(occupation, 1, 1) || ')' as name_occupation
    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 asc;

  • @chandrimakhastagir2402
    @chandrimakhastagir2402 ปีที่แล้ว +1

    Thanks.The series has been very very helpful.

  • @sid_x_18
    @sid_x_18 ปีที่แล้ว +4

    sir I am trying to get a job as Data Analyst and learning all the things from only TH-cam and I am from a non tech background . I have done some basic python , sql , pandas , numpy , matplotlib and seaborn libraries from youtube only and now trying to solve questions on SQL from hackerrank so are these questions enough to give me enough practice to crack interviews on SQL only ?

    • @dev.19.community
      @dev.19.community  ปีที่แล้ว

      as Fresher these things are enough, If u think ur basics are now at some good level, try giving interviews bcoz interviews will give u lot of experience

    • @chetanreddy2076
      @chetanreddy2076 ปีที่แล้ว

      @siddheshshinde4805 bro can Please Recommend me TH-cam Channels for Learning Python Libraries those You Mentioned Above.

    • @sid_x_18
      @sid_x_18 ปีที่แล้ว

      @@chetanreddy2076 freecodecamp

  • @itikshamittal
    @itikshamittal 9 หลายเดือนก่อน

    Great but why u used order by count(occupation), occupation at the end what it is used for

  • @sravanibodapati1585
    @sravanibodapati1585 5 หลายเดือนก่อน

    Getting error with code you have provided
    Select Concat(name, "(",left(name,1),")") from occupations order by name;

  • @muthu8025
    @muthu8025 ปีที่แล้ว +1

    I am getting an error for the same query

  • @souvikbiswas7042
    @souvikbiswas7042 ปีที่แล้ว

    SELECT concat(Name, '(',LEFT(Occuaption,1),')')
    FROM OCCUPATIONS
    ORDER BY Name;
    SELECT concat('There are a total of ',count(Occupation),' ',lower(Occupation), 's.')
    FROM OCCUPATIONS
    GROUP BY Occupation
    ORDER BY count(Occupation), Occupation
    I am getting an error. But can't find any error.

    • @anonymousboy9511
      @anonymousboy9511 ปีที่แล้ว

      try this
      SELECT CONCAT(Name,"(", LEFT(Occupation,1),")") FROM OCCUPATIONS
      UNION
      SELECT CONCAT("There are a total of ",COUNT(*)," ",LOWER(Occupation),"s.")
      FROM OCCUPATIONS
      GROUP BY Occupation ORDER BY 1

    • @praneethveeramachaneni6672
      @praneethveeramachaneni6672 ปีที่แล้ว

      @@anonymousboy9511 order by 1, how it works??