본문 바로가기

728x90

SQL

[HackerRank/MySQL] The PADS 1. '이름(직업 맨 앞글자)' 형태로 이름을 오름차순으로 출력 2. 'There are a total of [occupation_count] [occupation]s.' 형태로 직업을 가진 사람의 수를 오름차순으로 출력 링크: https://www.hackerrank.com/challenges/the-pads/problem The PADS | HackerRank Query the name and abbreviated occupation for each person in OCCUPATIONS. www.hackerrank.com * LIMIT 100은 데이터 양을 모르기 때문에 임의로 선택한 숫자임. (SELECT CONCAT(name, '(', LEFT(occupat.. 더보기
[HackerRank/MySQL] Type of Triangle 삼각형 종류 구하기 Equilateral: 3변의 길이가 모두 같음. Isosceles: 3변 중 2변의 길이가 같음. Scalene: 3변 모두 길이가 다름. Not A Triangle: 한 변의 길이가 다른 두변의 길이의 합보다 큼. 링크: https://www.hackerrank.com/challenges/what-type-of-triangle/problem Type of Triangle | HackerRank Query a triangle's type based on its side lengths. www.hackerrank.com SELECT CASE WHEN (a=b) AND (b=c) THEN 'Equilateral' WHEN (a+b 더보기
[HackerRank/MySQL] Employee Salaries 월급이 2000 초과이고, 근무월수가 10개월 미만인 직원 이름 구하기 (id 오름차순으로 정렬) 링크: https://www.hackerrank.com/challenges/salary-of-employees/problem Employee Salaries | HackerRank Print the names of employees who earn more than $2000 per month and have worked at the company for less than 10 months. www.hackerrank.com SELECT name FROM employee WHERE (salary > 2000) AND (months < 10) ORDER BY employe.. 더보기
[HackerRank/MySQL] Employee Names 이름 오름차순으로 출력 링크: https://www.hackerrank.com/challenges/name-of-employees/problem Employee Names | HackerRank Print employee names. www.hackerrank.com SELECT name FROM employee ORDER BY name ASC SELECT 문 (조건검색) SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워드와 함께 검색하고 싶은 속성이 있는 데이블의 이름을 나열 ORDER BY: 결과 테이블 내용을 원하는 순서로 출력. 오름차순(기본): ASC, 내림차순: DESC 더보기
[HackerRank/MySQL] Higher Than 75 Marks MARKS가 75 초과인 학생 이름을 이름의 마지막 3자리 기준으로 오름차순 정렬 마지막 3자리가 동일하면 ID 기준으로 오름차순 정렬 링크: https://www.hackerrank.com/challenges/more-than-75-marks/problem Higher Than 75 Marks | HackerRank Query the names of students scoring higher than 75 Marks. Sort the output by the LAST three characters of each name. www.hackerrank.com SELECT name FROM students WHERE marks > 75 ORDER BY RIGHT(name.. 더보기
[HackerRank/MySQL] Weather Observation Station 12 모음(a, e, i, o, u)으로 시작하지 않고, 끝나지도 않는 CITY 이름 출력 링크: https://www.hackerrank.com/challenges/weather-observation-station-12/problem Weather Observation Station 12 | HackerRank Query an alphabetically ordered list of CITY names not starting and ending with vowels. www.hackerrank.com SELECT DISTINCT city FROM station WHERE (LEFT(city, 1)NOT IN('a', 'e', 'i', 'o', 'u')) AND (RIGHT.. 더보기
[HackerRank/MySQL] Weather Observation Station 11 모음(a, e, i, o, u)으로 시작하지 않거나 끝나지 않는 CITY 이름 출력 링크: https://www.hackerrank.com/challenges/weather-observation-station-11/problem Weather Observation Station 11 | HackerRank Query a list of CITY names not starting or ending with vowels. www.hackerrank.com SELECT DISTINCT city FROM station WHERE (LEFT(city, 1)NOT IN('a', 'e', 'i', 'o', 'u')) OR (RIGHT(city, 1)NOT IN('a', 'e', '.. 더보기
[HackerRank/MySQL] Weather Observation Station 10 모음(a, e, i, o, u)으로 끝나지 않는 CITY 이름 출력 링크: https://www.hackerrank.com/challenges/weather-observation-station-10/problem Weather Observation Station 10 | HackerRank Query a list of CITY names not ending in vowels. www.hackerrank.com SELECT DISTINCT city FROM station WHERE RIGHT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u') SELECT DISTINCT city FROM station WHERE SUBSTRING(city, -1.. 더보기

728x90