SQL

SQL_DAY3

parkjiu 2023. 10. 26. 20:23

 

WHERE ์ ˆ

 

์—ฐ์‚ฐ์ž

  • ๋น„๊ต ์—ฐ์‚ฐ์ž
    • =, >, ≥, <, ≤
  • SQL ์—ฐ์‚ฐ์ž
    • BETWEEN a AND b
    • IN()
    • LIKE ‘๋น„๊ต๋ฌธ์ž์—ด’
      • ex) WHERE emp_name LIKE ‘๋ฐ•%’๊ฒฐ๊ณผ: ๋ฐ•์ง€์šฐ, ๋ฐ•ํ˜•์‹, ๋ฐ•ํ•ด์ง„
      • ex) WHERE emp_name LIKE ‘๋ฐ•์ง€_’ ๊ฒฐ๊ณผ: ๋ฐ•์ง€์šฐ
      • ex) WHERE emp_name LIKE ‘%์ง€%’ ๊ฒฐ๊ณผ: ๋ฐฐ์ˆ˜์ง€, ๋ฐ•์ง€์šฐ, ์ง€์ง€์ง€์ง€๋ฒ ์ด๋น„๋ฒ ์ด๋น„
    • IS NULL
  • ๋…ผ๋ฆฌ ์—ฐ์‚ฐ์ž
    • AND
    • OR
    • NOT
  • ๋ถ€์ • ๋น„๊ต ์—ฐ์‚ฐ์ž
    • ≠, ^=, <>
    • NOT ์นผ๋Ÿผ๋ช… =
    • NOT ์นผ๋Ÿผ๋ช… >
  • ๋ถ€์ • SQL ์—ฐ์‚ฐ์ž
    • NOT BETWEEN a AND b
    • NOT IN()
    • IS NOT NULL

ROWNUM & TOP

  • ์˜๋ฏธ: SQL ์ฒ˜๋ฆฌ ๊ฒฐ๊ณผ ์ง‘ํ•ฉ์˜ ๊ฐ ํ–‰์— ๋Œ€ํ•ด ์ž„์‹œ๋กœ ๋ถ€์—ฌ๋˜๋Š” ์ผ๋ จ๋ฒˆํ˜ธ
  • ex) WHERE ROWNUM < 3 3๊ฐœ ํ–‰ ์ถœ๋ ฅ.
  • ex) SELECT TOP(3) emp_name
  • ORDER BY ์ ˆ์ด ์‚ฌ์šฉ๋˜๋ฉด ROWNUM ๊ณผ TOP์— ๊ธฐ๋Šฅ ์ฐจ์ด ๋ฐœ์ƒ

 


Uploaded by

N2T

 

'SQL' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

SQL-DAY5  (2) 2023.10.28
SQL_DAY4  (0) 2023.10.26