![]() ![]() ![]() ![]() This tutorial is only for Educational and Learning Purpose. Solution – Occupations in SQL MySQL set min(Doctor), min(Professor), min(Singer), min(Actor)įrom(select case when Occupation="Doctor" then when Occupation="Professor" then when Occupation="Singer" then when Occupation="Actor" then end as RowNumber,Ĭase when Occupation="Doctor" then Name end as Doctor,Ĭase when Occupation="Professor" then Name end as Professor,Ĭase when Occupation="Singer" then Name end as Singer,Ĭase when Occupation="Actor" then Name end as Actor from OCCUPATIONS order by Nameĭisclaimer: The above Problem ( Occupations) is generated by Hacker Rank but the Solution is Provided by CodingBroz. The empty cell data for columns with less than the maximum number of names per occupation (in this case, the Professor and Actor columns) are filled with NULL values. The fourth column is an alphabetically ordered list of Actor names. Build skills-based coding tests with tech problems a developer would encounter on the job and hire the team behind your next big idea. The third column is an alphabetically ordered list of Singer names. Start free trial Focus on what really matters: the code. The second column is an alphabetically ordered list of Professor names. The first column is an alphabetically ordered list of Doctor names. mysql challenge sql hackerrank mysql-database hackerrank-solutions hackerrank-sql hackerrank-sql-solutions Updated kishanrajput23 / HackerRank-Solutions Star 4. Occupation will only contain one of the following values: Doctor, Professor, Singer or Actor. The solutions of all SQL hackerrank challenges using MySQL. The OCCUPATIONS table is described as follows: Column There could be a couple reasons for this: Your code doesnt match the expected output. Note: Print NULL when there are no more names corresponding to an occupation. If a lot of people have already solved a challenge, the odds are that the issue is in your code. Let N be the number of CITY entries in STATION, and let N’ be the number of distinct CITY names in STATION query the value of N-N’ from STATION. SELECT DISTINCT CITY FROM STATION WHERE MOD(ID, 2) 0 IX. The output column headers should be Doctor, Professor, Singer, and Actor, respectively. where LATN is the northern latitude and LONGW is the western longitude. Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |