DB(Database)/Basic Concept

[DB] SQL์˜ ๋ถ„๋ฅ˜(DML, DDL, DCL)

ํƒฑ์ ค 2021. 1. 15. 00:17

SQL์˜ ๋ถ„๋ฅ˜

  • DML (Data Manipulation Language)
  • DDL (Data Definition Language)
  • DCL (Data Control Language)

  1. DML (Data Manipulation Language)
    • ๋ฐ์ดํ„ฐ ์กฐ์ž‘ ์–ธ์–ด
    • SELECT, INSERT, DELETE, UPDATE ๋“ฑ
    • ํŠธ๋žœ์žญ์…˜ ๋ฐœ์ƒ-->๋กค๋ฐฑ์œผ๋กœ ์ทจ์†Œ ๊ฐ€๋Šฅ (rollback;) 
      • ํŠธ๋žœ์žญ์…˜: ํ…Œ์ด๋ธ”์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•  ๋•Œ ๋ฐ”๋กœ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๊ณ  ์ž„์‹œ๋กœ ์ ์šฉ์‹œํ‚ค๋Š” ๊ฒƒ
      • ์ปค๋ฐ‹(COMMIT): ํŠธ๋žœ์žญ์…˜์˜ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ฐ˜์˜ํ•˜๋Š” ๊ฒƒ
      • ์ทจ์†Œ(ROLLBACK): ํŠธ๋žœ์žญ์…˜์˜ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜์˜ํ•˜์ง€ ์•Š๊ณ  ์›๋ž˜ ์ƒํƒœ๋กœ ๋˜๋Œ๋ฆฌ๋Š” ๊ฒƒ 
  2. DDL (Data Definition Language)
    • ๋ฐ์ดํ„ฐ ์ •์˜ ์–ธ์–ด
    • CREATE, DROP, ALTER ๋“ฑ
    • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค, ํ…Œ์ด๋ธ”, ๋ทฐ ๋“ฑ์˜ ๊ฐœ์ฒด๋ฅผ ์ƒ์„ฑ/์‚ญ์ œ/๋ณ€๊ฒฝํ•˜๋Š” ์—ญํ• 
    • ํŠธ๋žœ์žญ์…˜ ๋ฐœ์ƒ X
      • ์‹คํ–‰ ์ฆ‰์‹œ ๋ฐ”๋กœ ์ ์šฉ๋จ
      • ROLLBACK์ด๋‚˜ COMMIT ์‚ฌ์šฉ ๋ถˆ๊ฐ€
  3. DCL (Data Control Language)
    • ๋ฐ์ดํ„ฐ ์ œ์–ด ์–ธ์–ด
    • ๊ถŒํ•œ ๋ถ€์—ฌ ํ˜น์€ ๋ฐ•ํƒˆํ•  ๋•Œ ์‚ฌ์šฉ
    • GRANT/REVOKE
728x90