반응형 hackerrank mysql30 [MySQL] Average Population ▶ SQL > Aggregation > Average Population Problem Query the average population for all cities in CITY, rounded down to the nearest integer. Input Format The CITY table is described as follows: My Answer SELECT ROUND(AVG(POPULATION)) FROM CITY NOTE ROUND 함수 : 반올림 ROUND(컬럼명) - 소수점 1번째 자리에서 반올림 (123.7 → 124) ROUND(컬럼명, 1) - 출력할 소수점 자리 지정 (123.75 → 123.8) ROUND(컬럼명, -1) - 10단위로 반올림 (123 → 120) TRUNCA.. 2021. 4. 21. [MySQL] Revising Aggregations - Averages ▶ SQL > Aggregation > Revising Aggregations - Averages Problem Query the average population of all cities in CITY where District is California. Input Format The CITY table is described as follows: My Answer SELECT AVG(POPULATION) FROM CITY WHERE DISTRICT = 'California' 2021. 4. 20. [MySQL] Revising Aggregations - The Sum Function SQL > Basic Select > Revising Aggregations - The Sum Function Problem Query the total population of all cities in CITY where District is California. Input Format The CITY table is described as follows: My Answer SELECT SUM(POPULATION) FROM CITY WHERE DISTRICT = 'California' 2021. 4. 20. [MySQL] Revising Aggregations - The Count Function ▶ SQL > Aggregation > Revising Aggregations - The Count Function Problem Query a count of the number of cities in CITY having a Population larger than 100,000. Input Format The CITY table is described as follows: My Answer SELECT COUNT(*) FROM CITY WHERE POPULATION > 100000 2021. 4. 20. [MySQL] Employee Salaries ▶ SQL > Basic Select > Employee Salaries Problem 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. →10개월 미만 직업으로 월급이 2000달러 이상인 직원. employee_id로 asc 정렬 Input Format The Employee table containing employee dat.. 2021. 4. 15. [MySQL] Employee Names ▶ SQL > Basic Select > Employee Names Problem 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.. 2021. 4. 15. 이전 1 2 3 4 5 다음 반응형