๐Ÿฌ MySQL

๋ฐ์ดํ„ฐ ๋ถ„์„ ํ”„๋กœ์ ํŠธ ์™œ ์ด๋ ‡๊ฒŒ ์–ด๋ ค์šธ๊นŒ? | ๊ฐ•์—ฐ ์ถ”์ฒœ, ์—ฐ์‚ฌ ์ธํ„ฐ๋ทฐ ๊ฐ€๋งŒํžˆ ์ƒ๊ฐ์„ ํ•ด๋ณด๋‹ˆ๊นŒ ์ด๊ฒŒ ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ๋งŒ๋“œ๋Š” ์‚ฌ๋žŒ์ด ๊ณต๋ถ€๋ฅผ ๋œ ํ–ˆ๋‹ค๊ฑฐ๋‚˜, ๋ถ„์„๊ฐ€๋กœ์จ์˜ ์ž์งˆ์ด ๋ถ€์กฑํ•ด์„œ ํ•˜๋Š” ์งˆ๋ฌธ์ด ์ ˆ๋Œ€ ์•„๋‹ˆ๋”๋ผ๊ตฌ์š”. datarian.io [๋ฐ์ดํ„ฐ ๋ถ„์„๊ฐ€ ์–ด๋–ป๊ฒŒ ์ค€๋น„ํ•ด์•ผ ํ• ๊นŒ?] 2023๋…„ 2์›” ์„ธ๋ฏธ๋‚˜ ์Šฌ๋ผ์ด๋“œ 2023๋…„ 2์›” ์„ธ๋ฏธ๋‚˜ ๋‹ค์‹œ๋ณด๊ธฐ! datarian.io ์œ ํŠœ๋ธŒ์— ๋ฐ์ดํ„ฐ ๋ถ„์„ ๊ด€๋ จ ์˜์ƒ์„ ์ฐพ์•„๋ณด๋˜ ์ค‘ ์šฐ์—ฐํžˆ ๋ฐœ๊ฒฌํ•˜๊ฒŒ ๋œ ๋ฐ์ดํ„ฐ๋ฆฌ์•ˆ์—์„œ ๋งค์›” ์„ธ๋ฏธ๋‚˜๋ฅผ ํ•˜๊ณ ์žˆ๋‹ค๋Š” ์†Œ์‹์„ ์ ‘ํ•˜๊ฒŒ ๋˜์—ˆ๊ณ  ์ด๋ฒˆ 2์›” ์„ธ๋ฏธ๋‚˜๋Š” ๋ฐœ๋น ๋ฅด๊ฒŒ ์‹ ์ฒญ์„ ํ•˜๊ฒŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. 2์›” ์›จ๋น„๋‚˜์˜ ์ฃผ์ œ๋Š” ๋ฐ์ดํ„ฐ ๋ถ„์„ ํ”„๋กœ์ ํŠธ ์™œ ์ด๋ ‡๊ฒŒ ์–ด๋ ค์šธ๊นŒ? ์ทจ์—…์„ ์ค€๋น„ํ•˜๊ณ  ์žˆ๋Š” ์ €์—๊ฒŒ๋Š” ๋งค์šฐ ์ด๋ชฉ์„ ์ด๋„๋Š” ์ฃผ์ œ์˜€๊ณ  ์ €๋… 7์‹œ~9์‹œ์— ์คŒ์œผ๋กœ ์ง„ํ–‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค! 1๋ถ€๋Š” ๋ฐ..
- ์ •๊ทœํ‘œํ˜„์‹์ด๋ž€? : ๋ฌธ์ž์—ด์—์„œ ํŒจํ„ด์„ ์ฐพ์•„๋‚ด๋Š” ์ผ์ข…์˜ ๊ทœ์น™ -> ์‹ค์ œ๋กœ ์ •๊ทœํ‘œํ˜„์‹์„ ๋‹ค ์•Œ๊ณ  ์“ฐ๋Š” ์‚ฌ๋žŒ์€ ๊ฑฐ์˜ ์—†์Œ.(๊ฒ€์ƒ‰์„ ํ•ด์„œ ์“ฐ๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋Œ€๋ถ€๋ถ„) -> ์ •๊ทœํ‘œํ˜„์‹์ด ์ด๋Ÿฐ๊ฑฐ๊ตฌ๋‚˜ ํ•˜๋Š” ์ดํ•ด์™€ ํŠœํ† ๋ฆฌ์–ผ ์‚ฌ์ดํŠธ์—์„œ ์กฐ๊ธˆ ์—ฐ์Šต์„ ํ•ด๋ณธ ํ›„์— ๊ทธ ๋‹ค์Œ๋ถ€ํ„ฐ๋Š” ํ•„์š”ํ•  ๋•Œ๋งˆ๋‹ค ๊ฒ€์ƒ‰์„ ํ•ด์„œ ์ฐพ์•„์“ธ ์ˆ˜ ์žˆ๋Š” ์ •๋„๋กœ ํ•™์Šตํ•  ๊ฒƒ. 1. ๋ฌธ์ œ Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates. where LAT_N is the northern latitude and LONG_W is the western longitude. -> STATION ํ…Œ์ด..
1. ๋ฌธ์ œ We define an employee's total earnings to be their monthly salary x months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as 2 space-separated integers. The Emplo..
*FROM์ ˆ, WHERE์ ˆ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์„œ๋ธŒ์ฟผ๋ฆฌ : ๊ฐ€์ƒ์˜ ํ…Œ์ด๋ธ”์„ ํ•˜๋‚˜ ๋” ๋งŒ๋“ ๋‹ค๋ผ๊ณ  ์ƒ๊ฐ Task : ๊ฐ ์ฃผ์˜ ํ‰๊ท  ๋ฒ”์ฃ„๋ฐœ์ƒ์„ COUNT ๋งค์ผ ๋ฒ”์ฃ„๊ฐ€ ๋ช‡๋ฒˆ ๋ฐœ์ƒํ–ˆ๋Š”์ง€๋ฅผ ํŒŒ์•…(์„œ๋ธŒ์ฟผ๋ฆฌ) -> ์ปฌ๋Ÿผ(week, date, incident_daily) ๊ฒฐ๊ณผ๋ฌผ : (2+1+3+1+1+1+2)/7 -> ๋งŒ์•ฝ 2020-01-06์— ๋ฒ”์ฃ„๊ฐ€ ์ผ์–ด๋‚˜์ง€ ์•Š์•„์„œ nan๊ฐ’์ผ๋•Œ๋Š” ์„œ๋ธŒ์ฟผ๋ฆฌ๊ฐ€ 2020-01-06์˜ incident_daily๋ฅผ ๊ณ„์‚ฐํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— (2+3+1+1+1+2)/6์œผ๋กœ ๊ณ„์‚ฐ์ด ๋จ. ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๋Š” 2020-01-06์˜ incident_daily๋ฅผ 0๊ฑด์œผ๋กœ ๋†“๊ณ  ๊ณ„์‚ฐํ•˜๊ณ  ์‹ถ์€ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์‚ฌ์‹ค์ƒ ๊ณ„์‚ฐ์€ (2+0+3+1+1+1+2)/7๋กœ ๊ณ„์‚ฐ์ด ๋˜์–ด์•ผํ•œ๋‹ค๋Š” ์ ์— ์œ ์˜ํ•  ๊ฒƒ! -> ํ‰๊ท , ๋‚ ์งœํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ..
1. ๋ฌธ์ œ Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table. The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. For example, if there are three records in the table with CITY values 'New York', 'New York', 'Bengalaru', there are 2 different city names: 'New Y..
1. ๋ฌธ์ œ Query the difference between the maximum and minimum populations in CITY. 2. ๋‚ดํ’€์ด SELECT MAX(POPULATION) - MIN(POPULATION) FROM CITY 3. ๊ฒฐ๊ณผ
1. ๋ฌธ์ œ Query the average population for all cities in CITY, rounded down to the nearest integer. -> rounded down : ๋ฒ„๋ฆผ 2. ๋‚ดํ’€์ด CEIL() : ์˜ฌ๋ฆผ ex) SELECT CEIL(5.5) => 6 FLOOR() : ๋‚ด๋ฆผ ex) SELECT FLOOR(5.5) => 5 ROUND() : ๋ฐ˜์˜ฌ๋ฆผ ex) ROUND(5.556901, 4) => 5.5569 SELECT FLOOR(AVG(POPULATION)) FROM CITY -> ๋‚ด๋ฆผ์„ ์œ„ํ•ด FLOOR()ํ•จ์ˆ˜๋กœ ๊ฐ์‹ธ์คŒ 3. ๊ฒฐ๊ณผ
1. ๋ฌธ์ œ Query a count of the number of cities in CITY having a Population larger than 100,000. (larger than=์ดˆ๊ณผ) 2. ๋‚ดํ’€์ด SELECT COUNT(ID) FROM CITY WHERE POPULATION > 100000 3. ๊ฒฐ๊ณผ
xod22
'๐Ÿฌ MySQL' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)