티스토리 뷰
[MySQL/Hackerrank] Higher Than 75 Marks, Employee Names, Employee Salaries
hoojiv 2021. 11. 2. 13:44Higher Than 75 Marks
Query the Name of any student in STUDENTS who scored higher than 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.
Input Format
The STUDENTS table is described as follows:
The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.
Sample Input
Sample Output
Ashley
Julia
Belvet
Explanation
Only Ashley, Julia, and Belvet have Marks > . If you look at the last three characters of each of their names, there are no duplicates and 'ley' < 'lia' < 'vet'.
SELECT NAME
FROM STUDENTS
WHERE Marks > 75
ORDER BY RIGHT(NAME,3),ID;
Employee Names
Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order.
Input Format
The Employee table containing employee data for a company is described as follows:
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is their monthly salary.
Sample Input
Sample Output
Angela
Bonnie
Frank
Joe
Kimberly
Lisa
Michael
Patrick
Rose
Todd
SELECT NAME
FROM Employee
ORDER BY NAME;
Employee Salaries
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.
Input Format
The Employee table containing employee data for a company is described as follows:
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is the their monthly salary.
Sample Input
Sample Output
Angela
Michael
Todd
Joe
SELECT NAME
FROM Employee
WHERE salary > 2000
AND months < 10
ORDER BY employee_id;
'Programming > MySQL' 카테고리의 다른 글
[MySQL/Hackerrank] Occupations (0) | 2021.11.02 |
---|---|
[MySQL/Hackerrank] The PADS (0) | 2021.11.02 |
[MySQL/Hackerrank] Type of Triangle (0) | 2021.11.02 |
[MySQL/Hackerrank] Weather Observation Station 1~12 (0) | 2021.11.02 |
[MySQL/Hackerrank] Revising the Select Query (0) | 2021.11.02 |
- Total
- Today
- Yesterday
- 에코캡
- 분석탭
- python3
- 코로나19
- 경구치료제
- 몰누피라비르
- 대원화성
- 미중무역전쟁
- MSSQL
- list
- python
- 리비안
- HK이노엔
- Weather Observation Station
- TSQL
- DATABASE
- 매매일지
- insert
- Tableau
- string
- 해커랭크
- 테슬라
- tensorflow
- 동국알앤에스
- mysql
- 넷플릭스
- MS SQL Server
- hackerrank
- 넥스트BT
- SQL Server
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |