Database -์กฐ๊ฑด WHERE, IN/ BETWEEN/ LIKE ๐Ÿฑโ€๐Ÿš€

ํ™”์ดํ‹ฐ ยท2024๋…„ 1์›” 2์ผ
0

Database

๋ชฉ๋ก ๋ณด๊ธฐ
2/8

1. WHERE

์›ํ•˜๋Š” ์ •๋ณด๋งŒ ์ถœ๋ ฅํ•˜๊ณ  ์‹ถ์„ ๋•Œ = ์กฐ๊ฑด
WHERE ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋ฉด ์กฐ๊ฑด์— ํ•ด๋‹นํ•˜๋Š” ํŠœํ”Œ๋งŒ ์ถœ๋ ฅ ๊ฐ€๋Šฅ

2. ๋น„๊ต์กฐ๊ฑด๊ณผ ๋…ผ๋ฆฌ์กฐ๊ฑด

๋น„๊ต ์กฐ๊ฑด

๋น„๊ต์กฐ๊ฑด์€ "=",">","<" ๋“ฑ์œผ๋กœ ๋น„๊ตํ•˜๋Š” ์กฐ๊ฑด

๋…ผ๋ฆฌ์กฐ๊ฑด ๊ฐœ๋… ์ •๋ฆฌ (AND, OR)

  • AND : ์กฐ๊ฑด1 AND ์กฐ๊ฑด2
    (๋ชจ๋‘ TRUE์—ฌ์•ผ TRUE๋ฐ˜ํ™˜, ํ•˜๋‚˜๋ผ๋„ FALSE๋ฉด FALSE ๋ฐ˜ํ™˜)

  • OR: ์กฐ๊ฑด1 OR ์กฐ๊ฑด2
    (์กฐ๊ฑด 1,2 ์ค‘ ํ•˜๋‚˜๋งŒ TRUE์—ฌ๋„ TRUE ๋ฐ˜ํ™˜ ๋ชจ๋‘ FALSE๋ฉด FALSE ์ž…๋‹ˆ๋‹ค.

3. IN/ BETWEEN/ LIKE ๐Ÿฑโ€๐Ÿ‘“

IN

IN = "=" ์˜ ๋ณต์ˆ˜ํ˜• ์—ฐ์‚ฌ์ž

IN ์—Ž์— NOT์ด ์žˆ์œผ๋ฉด ํŠน์ • ์กฐ๊ฑด์„ ์ œ์™ธํ•œ ๋ชจ๋“  ๊ฒฝ์šฐ์ถœ๋ ฅ

BETWEEN

BETWEEN A AND B ์˜ ํ˜•ํƒœ๋กœ ์‚ฌ์šฉํ•˜๋ฉด, A์™€ B์˜ ์‚ฌ์ด์— ์žˆ๋Š” ๊ฐ’์„ ์ถœ๋ ฅ (๋ฒ”์œ„์กฐ๊ฑด ์—ฐ์‚ฐ)

LIKE

LIKE: ๋งค์นญ ์—ฐ์‚ฐ์ž, ~ ๋กœ ์‹œ์ž‘ํ•˜๋Š” (๋๋‚˜๋Š”) ๋‹จ์–ด๋ฅผ ํƒ์ƒ‰

  • LIKE๋Š” _์™€ %๋กœ ์ด์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ๊ฒฐ๊ณผ ์ถœ๋ ฅ ๊ฐ€๋Šฅ

profile
์—ด์‹ฌํžˆ ๊ณต๋ถ€ํ•ฉ์‹œ๋‹ค! The best is yet to come! ๐Ÿ’œ

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