SQL/HackerRank

문제 You are given a table, BST, containing two columns: N and P, where N represents the value of a node in Binary Tree, and P is the parent of N. Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node: Root: If node is root node. Leaf: If node is leaf node. Inner: If node is neither root nor leaf node. https://www.hackerrank...
문제 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. Input Format The OCCUPATIONS table is described as follows: Occupation will only contain..
문제 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 asc..
문제 P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5): * * * * * * * * * * * * * * * Write a query to print the pattern P(20). https://www.hackerrank.com/challenges/draw-the-triangle-2/problem?isFullScreen=true Draw The Triangle 2 | HackerRank Draw the triangle pattern using asterisks. www.hackerrank.com 문제 풀이 SET @star := 0; SELECT REPEAT('* ', @star := @s..
문제 P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5): * * * * * * * * * * * * * * * Write a query to print the pattern P(20). https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true Draw The Triangle 1 | HackerRank Draw the triangle pattern using asterisks. www.hackerrank.com 문제 풀이 SET @star := 21; SELECT REPEAT('* ', @star := @..
문제 Query the Western Longitude (LONG_W)where the smallest Northern Latitude (LAT_N) in STATION is greater than 38.7780. Round your answer to 4 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. https://www.hackerrank.com/challenges/weather-observation-station-17/problem?isFullScreen=true Weather Observ..
문제 Query the smallest Northern Latitude (LAT_N) from STATION that is greater than 38.7780. Round your answer to 4 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. https://www.hackerrank.com/challenges/weather-observation-station-16/problem?isFullScreen=true Weather Observation Station 16 | HackerRank..
문제 Query the greatest value of the Northern Latitudes (LAT_N) from STATION that is less than 137.2345. Truncate your answer to 4 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. https://www.hackerrank.com/challenges/weather-observation-station-14/problem?isFullScreen=true Weather Observation Station ..
문제 Query the sum of Northern Latitudes (LAT_N) from STATION having values greater than 38.7880 and less than 137.2345. Truncate your answer to 4 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. 문제 풀이 SELECT TRUNCATE(SUM(lat_n),4) FROM station WHERE lat_n > 38.7880 AND lat_n < 137.2345; SQL을 독학하시는 분들에..
문제 Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of decimal places. The sum of all values in LONG_W rounded to a scale of decimal places.\ Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. Output Format Your results must be in the form: lat lon where lat is t..
zinni
'SQL/HackerRank' 카테고리의 글 목록