๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์ „์ฒด ๊ธ€77

[Docker] Docker Container ์•ˆ์˜ ํŒŒ์ผ์„ ๋กœ์ปฌ๋กœ ์ด๋™ํ•˜๊ธฐ AWS EC2 ์•ˆ์—์„œ ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” docker container ์•ˆ์— ์Œ“์ด๊ณ  ์žˆ๋Š” ๋กœ๊ทธ ํŒŒ์ผ์„ ๋กœ์ปฌ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ ๋„์ปค ์ปจํ…Œ์ด๋„ˆ์— ์žˆ๋Š” ํŒŒ์ผ์„ EC2๋กœ ์ด๋™ํ•˜๊ธฐ์šฐ์„  aws ํŽจํ‚ค๋ฅผ ํ†ตํ•ด EC2์— ssh๋กœ ์ ‘์†ํ•ด์ค๋‹ˆ๋‹ค.ssh -i [ํŽจํ‚ค๊ฒฝ๋กœ] [์‚ฌ์šฉ์ž์ด๋ฆ„]@[์ธ์Šคํ„ด์Šค์˜ ip ๋˜๋Š” ํผ๋ธ”๋ฆญ dns] ๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด docker container ์•ˆ์— ์ ‘์†ํ•ด์ค๋‹ˆ๋‹ค.container id๋Š” docker ps ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.sudo docker exec -it [์ปจํ…Œ์ด๋„ˆid] sh ์ด๋ ‡๊ฒŒ ์ ‘์†์„ ํ–ˆ๋‹ค๋ฉด, ๋‹ค์šด๋กœ๋“œํ•˜๊ณ ์ž ํ•˜๋Š” ํŒŒ์ผ์˜ ๊ฒฝ๋กœ๊ฐ€ ์–ด๋”˜์ง€ ํŒŒ์•…ํ•ด์ค๋‹ˆ๋‹ค์ €๋Š” /log ์•ˆ์— ๋‹ค์šด ๋ฐ›๊ณ ์ž ํ•˜๋Š” ํŒŒ์ผ์ด ์žˆ์Šต๋‹ˆ๋‹ค. exit ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ปจํ…Œ์ด๋„ˆ์—์„œ ๋น ์ ธ๋‚˜์˜ค๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ๋‹ค์šด ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ.. 2024. 11. 20.
[Java / ๋ฐฑ์ค€ ] 12851. ์ˆจ๋ฐ”๊ผญ์งˆ ๋ฌธ์ œ๋งํฌ: https://www.acmicpc.net/problem/12851ํƒœ๊ทธ: bfs ํ’€์ด ์ˆจ๋ฐ”๊ผญ์งˆ ๋ฌธ์ œ์™€ ๋™์ผํ•˜์ง€๋งŒ, ๋‹ค๋ฅธ ์ ์ด ์žˆ๋‹ค๋ฉด ์ด๋ฏธ ๋ฐฉ๋ฌธํ•œ ์ง€์ ๋„ ์žฌ๋ฐฉ๋ฌธ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ํ•ด์•ผํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.์žฌ๋ฐฉ๋ฌธ์ด ๊ฐ€๋Šฅํ•œ ๊ธฐ์ค€์€ ์ด์ „์— ๋ฐฉ๋ฌธํ–ˆ๋˜ ์‹œ๊ฐ„๊ณผ ๋‹ค์‹œ ๋ฐฉ๋ฌธํ•˜๋ ค๊ณ  ํ• ๋•Œ์˜ ๋„๋‹ฌ ์‹œ๊ฐ„์ด ๊ฐ™์„ ๋•Œ์ž…๋‹ˆ๋‹ค.๋‹ค์‹œ ๋ฐฉ๋ฌธํ•˜๋ ค๊ณ  ํ• ๋•Œ, ์ด์ „์— ๋„๋‹ฌํ–ˆ๋˜ ์‹œ๊ฐ„๋ณด๋‹ค ํฌ๋‹ค๋ฉด, K์— ๋„๋‹ฌํ–ˆ์„ ๋•Œ ์ตœ๋‹จ ์‹œ๊ฐ„์ด ๋  ๊ฐ€๋Šฅ์„ฑ์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ œ์™ธ์‹œ์ผœ์ค๋‹ˆ๋‹ค. vis ๋ฐฐ์—ด์„ ์„ ์–ธํ•ด์ฃผ๊ณ  ์ด๋ฅผ ๋ชจ๋‘ ์ตœ๋Œ€๊ฐ’์œผ๋กœ ์ดˆ๊ธฐํ™” ํ•ด์ค€ ๋‹ค์Œ, vis[next] ์ „์ฒด ์ฝ”๋“œimport java.io.BufferedReader;import java.io.InputStreamReader;import java.util.*;class Main { public stat.. 2024. 11. 20.
[MySQL] SQL ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 4๋‹จ๊ณ„ ๋‹ค ํ’€์–ด๋ณด๊ธฐ (2) 6๋ฌธ์ œ์ž๋™์ฐจ ๋Œ€์—ฌ ๊ธฐ๋ก ๋ณ„ ๋Œ€์—ฌ ๊ธˆ์•ก ๊ตฌํ•˜๊ธฐ ํฌ์ธํŠธ: ์„œ๋ธŒ ์ฟผ๋ฆฌ, WITH ์ ˆ, ๋Œ€์—ฌ ๊ธฐ๊ฐ„์€ DATEDIFF + 1์ด๋ผ๋Š”๊ฑฐ, CASE WHEN THEN END ๋ฌธ ๋„ˆ๋ฌด ์–ด๋ ต๋‹ค.. https://school.programmers.co.kr/learn/courses/30/lessons/151141 ํ”„๋กœ๊ทธ๋ž˜๋จธ์ŠคSW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„programmers.co.kr WITH DISCOUNT AS (SELECT H.HISTORY_ID AS HISTORY_ID, C.DAILY_FEE AS DAILY_FEE,DATEDIFF(H.END_DATE, H.START_DATE) + 1 AS DATEDIFF, C.CAR_TYPE AS CAR_T.. 2024. 11. 10.
[MySQL] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค SQL 4๋‹จ๊ณ„ ๋ชจ๋‘ ํ’€์–ด๋ณด๊ธฐ! (1) 6๋ฌธ์ œ ์šฐ์œ ์™€ ์š”๊ฑฐํŠธ๊ฐ€ ๋‹ด๊ธด ์žฅ๋ฐ”๊ตฌ๋‹ˆ๋ถ„๋ฅ˜, ํฌ์ธํŠธ: IN ์ ˆhttps://school.programmers.co.kr/learn/courses/30/lessons/62284 ํ”„๋กœ๊ทธ๋ž˜๋จธ์ŠคSW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„programmers.co.kr SELECT DISTINCT CART_IDFROM CART_PRODUCTSWHERE CART_ID IN ( -- ์šฐ์œ  SELECT CP1.CART_ID FROM CART_PRODUCTS AS CP1 WHERE CP1.NAME = 'Milk')AND CART_ID IN ( -- ์š”๊ฑฐํŠธ SELECT CP1.CART_ID FROM CART_PRODUCTS AS CP1 WHERE C.. 2024. 11. 9.
[MySQL] WITH, WITH RECURSIVE ๊ตฌ๋ฌธ WITH ๊ตฌ๋ฌธwith ๊ตฌ๋ฌธ์€ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์— ๊ฐ€์ƒ์˜ ํ…Œ์ด๋ธ”์„ ์ €์žฅํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.RECURSIVE์˜ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์žฌ๊ท€์™€ ๋น„์žฌ๊ท€ ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์œผ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. WITH [RECURSIVE] TABLE๋ช… AS ( SELECT - # ๋น„๋ฐ˜๋ณต๋ฌธ. ๋ฌด์กฐ๊ฑด ํ•„์ˆ˜ [UNION ALL] # RECURSIVE ์‚ฌ์šฉ ์‹œ ํ•„์ˆ˜. ๋‹ค์Œ์— ์ด์–ด๋ถ™์–ด์•ผ ํ•  ๋•Œ ์‚ฌ์šฉ SELECT - [WHERE -] # RECURSIVE ์‚ฌ์šฉ ์‹œ ํ•„์ˆ˜. ์ •์ง€ ์กฐ๊ฑด ํ•„์š”ํ•  ๋•Œ ์‚ฌ์šฉ) WITH RECURSIVE ๊ตฌ๋ฌธWITH RECURSIVE ๊ตฌ๋ฌธ์€ ๊ฐ€์ƒ ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜๋ฉด์„œ ๊ฐ€์ƒ ํ…Œ์ด๋ธ” ์ž์‹ ์˜ ๊ฐ’์„ ์ฐธ์กฐํ•˜์—ฌ ๊ฐ’์„ ๊ฒฐ์ •ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.WITH RECURSIVE CTE AS ( SELECT 1 AS NUM -- ์ดˆ๊ธฐ๊ฐ’ ์„ค์ • .. 2024. 11. 9.
[MySQL] ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„๋ฅผ ์œ„ํ•œ MySQL ๋‚ด์žฅํ•จ์ˆ˜ ์ •๋ฆฌ ๋ฌธ์ž์—ด ๊ด€๋ จ ๋‚ด์žฅ ํ•จ์ˆ˜LOCATE("A", "ABC"): "ABC"์—์„œ "A"๊ฐ€ ๋ช‡๋ฒˆ์งธ์ธ์ง€๋ฅผ ๋ฐ˜ํ™˜SUBSTRING("abc", 2): 2๋ฒˆ์งธ ๋ฌธ์ž๋ถ€ํ„ฐ ๋ฐ˜ํ™˜RIGHT("ABCD", 1): "ABCD" ์˜ค๋ฅธ์ชฝ์—์„œ 1๋ฒˆ์งธ๊นŒ์ง€LEFT("ABCD, 1): "ABCD" ์™ผ์ชฝ์—์„œ 1๋ฒˆ์งธ๊นŒ์ง€UPPER(str), LOWER(str): ๋Œ€๋ฌธ์ž๋กœ ๋ณ€ํ™˜, ์†Œ๋ฌธ์ž๋กœ ๋ณ€ํ™˜CONCAT("ABC", "DEF", "GHI"): ๋ฌธ์ž์—ด ์ด์–ด๋ถ™์ด๊ธฐREPLACE("ABC", "A", "Z"): "ABC"์˜ "A"๋ฅผ "Z"๋กœ ๋ณ€ํ™˜LPAD("DEF", 5, "_"): "DEF" ์™ผ์ชฝ์— "_"๋ฅผ ์ „์ฒด ๋ฌธ์ž์—ด์ด 5๊ธ€์ž๊ฐ€ ๋˜๋„๋ก ๋ถ™์ด๊ธฐ  ์ˆซ์žํ˜•ABS(์ˆซ์ž): ์ ˆ๋Œ€๊ฐ’ ๋ฐ˜ํ™˜CEILING(์‹ค์ˆ˜): ์˜ฌ๋ฆผFLOOR(์‹ค์ˆ˜): ๋‚ด๋ฆผROUND(์‹ค์ˆ˜): ๋ฐ˜์˜ฌ๋ฆผTR.. 2024. 11. 9.