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.
- Prepare
- SQL
- Advanced Select
- The PADS
- Discussions
The PADS
The PADS
Sort by
recency
|
4933 Discussions
|
Please Login in order to post a comment
SELECT CONCAT(Name, '(', LEFT(Occupation, 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);
Why as to this is wrong? and how can I correct it?
With ABC as ( Select Concat(Name,"(",Substr(occupation,1,1),")") from (Select Name, occupation from OCCUPATIONS order by 1) A ), XYZ as ( Select Concat("There are a total of ",cnt , " ",occupation ) from (Select occupation,count(occupation) as cnt from OCCUPATIONS group by 1 order by 2,1) B ) Select * from ABC union all Select * from XYZ
There is something wrong in hackerank with sql snippet even after submitting right code it is showing test cases failed. dunnno why? SELECT name || '(' || SUBSTR(occupation, 1, 1) || ')' AS formatted_name FROM occupations ORDER BY name ASC;
SELECT 'There are a total of ' || count(occupation) || ' ' || occupation||'.' FROM occupations GROUP BY occupation ORDER BY COUNT(occupation) ASC;
SELECT Name + '(' + LEFT(Occupation,1) + ')' FROM OCCUPATIONS ORDER BY Name; SELECT 'There are a total of' + ' ' + CAST(COUNT(Occupation) AS VARCHAR(5)) + ' ' + LOWER(Occupation) + 's.' FROM OCCUPATIONS GROUP BY Occupation ORDER BY COUNT(Occupation);
**Check out the complete video solution here - https://www.youtube.com/watch?v=-IEwjNJNHrQ&ab_channel=NishthaNagar **