Posts

Showing posts from March, 2018

The Occupation: hackerrank problem

Problem Statement: Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation . The output column headers should be Doctor , Professor , Singer , and Actor , respectively. Note: Print NULL when there are no more names corresponding to an occupation. Table:   'OCCUPATIONS' table contain the column 'Name' and 'Occupation' Solution: select doc,prof,singer,act from ( select row_number() over(partition by Occupation order by Name) ron,Name as n,Occupation as o from OCCUPATIONS ) pro pivot (max(n)  for o in ('Doctor' as doc,'Actor' as act,'Professor' as prof,'Singer' as singer))  order by ron asc; Explanation: in the above query statement i am using row_number() function with the 'partition by' clause to append one column that contains row_number for each row in the subquery. in the subquery while assigning row_number() we

Hackerrank: The Pads

Problem Statement: Generate the following two result sets: Query an alphabetically ordered list of all names in OCCUPATIONS , immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example: AnActorName(A) , ADoctorName(D) , AProfessorName(P) , and ASingerName(S) . Query the number of ocurrences of each occupation in OCCUPATIONS . Sort the occurrences in ascending order , and output them in the following format: There are a total of [occupation_count] [occupation]s. where [occupation_count] is the number of occurrences of an occupation in OCCUPATIONS and [occupation] is the lowercase occupation name. If more than one Occupation has the same [occupation_count] , they should be ordered alphabetically. Note: There will be at least two entries in the table for each type of occupations. SOLUTION: here is what you have been looking for.. the query format is for the oracle SQL. The problem uses

How to recover if all the partitions in the system marked "deleted".

I first came across this problem when I was trying to install the Ubuntu 14.04 alongside windows 8...I installed it in legacy firmware while the windows was in UEFI  firmware this caused the problem and started showing all partition as deleted and I was not able to boot into the any system ... now moving on to the solution ..... Before procee ding further ..First try to repair it using official windows 10/8 live cd/thumbdrive. Try the below link for reference if you are doing it for the first time... How to repair/reset windows? If the repairing windows doesn 't solves the issue. And windows still doesn't boot up try the method 1. Method 1 : 1. make a windows bootable thumbdrive or use your recovery CD and follow this instructions. If you don't know how to make a bootable ... Follow this tutorial given below .. Link to make bootable pendrive/thumbdrive. 2. Now that your bootable thumbdrive is ready. Insert it and boot from it. If it doesn&