SQL | HackerRank MAX(CASE WHEN…)을 활용한 피벗(Pivot) 쿼리
·
Computer Science/SQL
Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output should consist of four columns (Doctor, Professor, Singer, and Actor) in that specific order, with their respective names listed alphabetically under each column.Note: Print NULL when there are no more names corresponding to an occupation.Input F..
SQL | HackerRank 문자열을 이어붙이기 (CONCAT)
·
Computer Science/SQL
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 ascendi..
SQL | HackerRank 정규표현식으로 도시 찾기 – DISTINCT와 REGEXP 활용
·
Computer Science/SQL
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.Input FormatThe STATION table is described as follows:where LAT_N is the northern latitude and LONG_W is the western longitude.select distinct city from station where city REGEXP '^[aeiouAEIOU]';SELECT DISTINCT CITY: 중복된 도시 이름 제거.WHERE CITY REGEXP '^[aeiouAEIOU]': 도시 이름이..
SQL | HackerRank 가장 짧고 긴 도시 이름 찾기 – 문자열 길이 기반 SQL 정렬과 조건 추출
·
Computer Science/SQL
Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically. The STATION table is described as follows:where LAT_N is the northern latitude and LONG_W is the western longitude.ExplanationWhen or..
SQL | HackerRank 삼각형 분류하기: 조건문 CASE를 활용한 다중 조건 처리
·
Computer Science/SQL
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 sides of equal length.Isosceles: It's a triangle with sides of equal length.Scalene: It's a triangle with sides of differing lengths.Not A Triangle: The given values of A, B, and C don't for..
SQL | LeetCode 1327. 특정 월 기준 주문량 분석하기
·
Computer Science/SQL
Table: Products+------------------+---------+| Column Name | Type |+------------------+---------+| product_id | int || product_name | varchar || product_category | varchar |+------------------+---------+product_id is the primary key (column with unique values) for this table.This table contains data about the company's products. Table: Orders+---------------+---------+| Col..
올리브한입
'Computer Science/SQL' 카테고리의 글 목록