๐Ÿ—‚๏ธ2024.07.02 TIL

Donghyunยท2024๋…„ 7์›” 2์ผ
0

TIL (Today I Learned)

๋ชฉ๋ก ๋ณด๊ธฐ
7/53
post-thumbnail

SQL

  1. TRUNCATE(number, decimals): ํŠน์ • ์ž๋ฆฌ์ˆ˜ ์ดํ•˜๋ฅผ ๋ฒ„๋ฆผํ•˜๋Š” ํ•จ์ˆ˜

    • number: ๋ฒ„๋ฆผํ•  ์ˆซ์ž
    • decimals: ์ˆซ์ž์˜ ์†Œ์ˆซ์  ์ดํ•˜ ์ž๋ฆฟ์ˆ˜ (์Œ์ˆ˜์ธ ๊ฒฝ์šฐ ์†Œ์ˆ˜์  ์ดํ•˜์˜ ์ž๋ฆฟ์ˆ˜๋ฅผ ์™ผ์ชฝ์—์„œ๋ถ€ํ„ฐ ์ œ๊ฑฐ)

    ex) PRICE = 12345์˜ ๊ฒฝ์šฐ, TRUNCATE(PRICE, -4) โ†’ 10000

    ex) PRICE = 123456.789์˜ ๊ฒฝ์šฐ, TRUNCATE(PRICE, -4) โ†’ 120000

    ex) PRICE = 123456.789์˜ ๊ฒฝ์šฐ, TRUNCATE(PRICE, -3) โ†’ 123000

    ex) PRICE = 123456.789์˜ ๊ฒฝ์šฐ, TRUNCATE(PRICE, 3) โ†’ 123456

    ์ฐธ๊ณ : https://velog.io/@ehdtkd98/ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค๊ฐ€๊ฒฉ๋Œ€-๋ณ„-์ƒํ’ˆ-๊ฐœ์ˆ˜-๊ตฌํ•˜๊ธฐ-SQL

Python

์˜ค๋Š˜ ํ‘ผ ํŒŒ์ด์ฌ ๋ฌธ์ œ:

https://velog.io/@ehdtkd98/ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์ตœ์†Œ์ง์‚ฌ๊ฐํ˜•-ํŒŒ์ด์ฌ

๋‚ด ํ’€์ด:

def solution(sizes):
    large_arr = []
    small_arr = []
    for i in sizes:
        large_arr.append(max(i))
        small_arr.append(min(i))

    return max(large_arr) * max(small_arr)

๋‹ค๋ฅธ ์‚ฌ๋žŒ์˜ ํ’€์ด:

def solution(sizes):
    return max(max(x) for x in sizes) * max(min(x) for x in sizes

๊ฐ™์€ ๋‚ด์šฉ์˜ ์ฝ”๋“œ์ด์ง€๋งŒ ์ฒ˜์Œ ์ € ํ•œ ์ค„์˜ ์ฝ”๋“œ๋ฅผ ๋ดค์„ ๋•Œ ์•„์ง ๊ฐˆ ๊ธธ์ด ์ •๋ง ๋ฉ€๋‹ค๋Š” ๊ฒƒ์„ ๋Š๊ผˆ๋‹ค. ๋ฆฌ์ŠคํŠธ ๋‚ดํฌ๋ฅผ ์ด๋Ÿฐ ์‹์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋‹ˆโ€ฆ

์•ž์œผ๋กœ๋Š” ๋ฌธ์ œ๋ฅผ ํ’€๋ฉด์„œ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ฝ”๋“œ๋ฅผ ์ ๊ฒ€ํ•˜๋Š” ์Šต๊ด€์„ ๋“ค์—ฌ์•ผ๊ฒ ๋‹ค!

profile
๋ฐ์ดํ„ฐ๋ถ„์„ ๊ณต๋ถ€ ์ผ๊ธฐ~!

0๊ฐœ์˜ ๋Œ“๊ธ€