[MySQL/HackerRank] The Blunder (+ Ceil, Convert, Cast 함수)
·
SQL/HackerRank
Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's 0 key was broken until after completing the calculation. She wants your help finding the difference between her miscalculation (using salaries with any zeros removed), and the actual average salary.Write a query calculating the amount of error (i.e.:  ave..
[MySQL/HackerRank] Population Density Difference
·
SQL/HackerRank
Query the difference between the maximum and minimum populations in CITY.Input FormatThe CITY table is described as follows: SELECT MAX(POPULATION) - MIN(POPULATION)FROM CITY
[MySQL/HackerRank] Japan Population
·
SQL/HackerRank
Query the sum of the populations for all Japanese cities in CITY. The COUNTRYCODE for Japan is JPN.Input FormatThe CITY table is described as follows: SELECT SUM(POPULATION)FROM CITYWHERE COUNTRYCODE='JPN'
[MySQL/HackerRank] Average Population
·
SQL/HackerRank
Query the average population for all cities in CITY, rounded down to the nearest integer.Input FormatThe CITY table is described as follows: SELECT ROUND(AVG(POPULATION), 0)FROM CITY
[MySQL/HackerRank] Revising Aggregations - Averages
·
SQL/HackerRank
Query the average population of all cities in CITY where District is California.Input FormatThe CITY table is described as follows:  SELECT AVG(POPULATION)FROM CITYWHERE DISTRICT = 'California'
[MySQL/HackerRank] Revising Aggregations - The Sum Function
·
SQL/HackerRank
Query the total population of all cities in CITY where District is California.Input FormatThe CITY table is described as follows:  SELECT SUM(POPULATION)FROM CITYWHERE DISTRICT = 'California'
[MySQL/HackerRank] Revising Aggregations - The Count Function
·
SQL/HackerRank
Query a count of the number of cities in CITY having a Population larger than 100,000.Input FormatThe CITY table is described as follows:  SELECT COUNT(*)FROM CITYWHERE POPULATION > 100000
[MySQL/HackerRank] New Companies
·
SQL/HackerRank
Amber's conglomerate corporation just acquired some new companies. Each of the companies follows this hierarchy: Given the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code.Note:The tables may contain duplic..
[MySQL/HackerRank] Binary Tree Nodes
·
SQL/HackerRank
You are given a table, BST, containing two columns: N and P, where N represents the value of a node in Binary Tree, and P is the parent of N.Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node:Root: If node is root node.Leaf: If node is leaf node.Inner: If node is neither root nor leaf node.Sample InputSample Output1 Leaf..
[MySQL/HackerRank] Occupations
·
SQL/HackerRank
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.Input FormatThe OCCUPATIONS table is described as follows:Occupation will only contain one of..
_xxxx
'SQL' 카테고리의 글 목록