🤖 코딩테스트 준비/해커랭크 (8) 썸네일형 리스트형 [SQL] 해커랭크(HackerRank) Medium - Occupations Q. 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. # Solution -> 아래와 같은 방식으로 sub query를 사용해서 진행했는데 틀렸다고 나옴.. select case when occupation oc.. [SQL] 해커랭크(HackerRank) Easy - Type of Triangles Q. Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table: Equilateral: It's a triangle with 3 sides of equal length. Isosceles: It's a triangle with 2 sides of equal length. Scalene: It's a triangle with 3 sides of differing lengths. Not A Triangle: The given values of A, B, and C.. [SQL] 해커랭크(HackerRank) Easy - Employee Salaries Q. Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than $2000 per month who have been employees for less than 10 months. Sort your result by ascending employee_id. # Solution select name from employee where salary >2000 and months [SQL] 해커랭크(HackerRank) Easy - Weather Observation Station 7 Q. Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates. # Solution select distinct city from station where right (city,1) in ('a','e','i','o','u') -> city 이름의 길이가 각자 다르기 때문에 right() 를 사용하여 해당 컬럼의 가장 오른쪽 하나가 해당 모음에 있는지로 필터적용 SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE('%a') OR CITY LIKE('%e') OR CITY LIKE('%i') OR CITY LIKE('%o.. [SQL] 해커랭크(HackerRank) - Easy3 1. Weather Observation Station 3 Query a list of CITY names from STATION for cities that have an even ID number. Print the results in any order, but exclude duplicates from the answer. SELECT DISTINCT CITY FROM STATION WHERE ID%2=0 ID값이 짝수인 Row의 결과값만을 반환하여 City 컬럼내의 값들을 호출해야한다. - 짝수인 ID는 2를 나눴을 때 나머지값이 0 https://www.hackerrank.com/challenges/weather-observation-station-3/problem?isFullScreen=tru.. [SQL] 해커랭크(HackerRank) - Easy4 1. Higher Than 75 Marks Query the Name of any student in STUDENTS who scored higher than 75 Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID. 2. Employee Names Write a query that prints a list of employee names (i.e.: the name attribu.. [SQL] 해커랭크(HackerRank) - Easy2 1. Weather Observation Station 1 Query a list of CITY and STATE from the STATION table. where LAT_N is the northern latitude and LONG_W is the western longitude. select city, state from STATION https://www.hackerrank.com/challenges/weather-observation-station-1/problem?isFullScreen=true Weather Observation Station 1 | HackerRank Write a query to print the CITY and STATE for each attribute in the.. [SQL] 해커랭크(HackerRank) - Easy1 1. Revising the Select Query 1 Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA. The CITY table is described as follows: SELECT * FROM CITY WHERE POPULATION > 100000 AND COUNTRYCODE = 'USA' https://www.hackerrank.com/challenges/revising-the-select-query/problem?isFullScreen=true Revising the Select Query I | Hacke.. 이전 1 다음