π[DB] DBμ SQLμ λν΄μβ¦
DBμ SQLμ λν΄μβ¦
λ°μ΄ν°λ² μ΄μ€λ?
- ν
μ΄λΈμ΄λ?
- λ°μ΄ν°λ₯Ό μ μ₯νλ νκ³Ό μ΄
-
- μ¬λ¬κ° μ‘΄μ¬ κ°λ₯
λ°μ΄ν° μ μμ΄ (DDL)
-
Data Definition Language
-
λ°μ΄ν°λ₯Ό λ΄μ 곡κ°μ μ μνλ μΈμ΄
- CREATE λ¬Έ
- λ°μ΄ν°λ² μ΄μ€ μμ±, ν μ΄λΈ μμ±
- ALTER λ¬Έ
- ν μ΄λΈ λ³κ²½
- DROP λ¬Έ
- λ°μ΄ν°λ² μ΄μ€ μμ , ν μ΄λΈ μμ
λ°μ΄ν° μ‘°μμ΄ (DML)
-
Data Manupulation Language
-
λ°μ΄ν° 곡κ°μ λ°μ΄ν°λ₯Ό μΆκ°, μμ , μμ , μ‘°ννλ μΈμ΄
- SELECT λ¬Έ
- SELECT μ‘°νν νλλͺ (μμ±) FROM ν μ΄λΈλͺ
- WHERE κ²μ쑰건
- νλλͺ = βκ°β
-
- [ =, <, >, <=, >= ]
-
- WHERE κ²μ쑰건1 AND κ²μ쑰건2 β¦
-
- WHERE κ²μ쑰건1 OR κ²μ쑰건2 β¦
- LIKE λ¬Έ
- νλ(μμ±) LIKE βλ¨μ΄β
-
- λ¨μ΄μ μΌμΉνλ 쑰건
-
- LIKE βλ¨μ΄%β : λ¨μ΄λ‘ μμνλ ν¨ν΄
-
- LIKE β%λ¨μ΄β : λ¨μ΄λ‘ λλλ ν¨ν΄
-
- LIKE β%λ¨μ΄%β : λ¨μ΄κ° ν¬ν¨λλ ν¨ν΄
- GROUP BY
- GROUP BY νλ(μμ±)
-
- κ°μ νλ(μμ±)κ°μΌλ‘ λ¬Άμ΄μ€λ€.
-
- μ£Όλ‘ ν΅κ³ ν¨μμ ν¨κ» λ§μ΄ μ°μΈλ€.
- COUNT()
- λ μ½λ μ
- MAX()
- μ΅λκ°
- MIN()
- μ΅μκ°
- SUM()
- ν©κ³
- AVG()
- ν΅κ³
- HAVING
- μ§κ³ ν¨μμ 쑰건
- ORDER BY
- μ λ ¬(μ€λ¦/λ΄λ¦Όμ°¨μ)
- DISTINCT
- μ€λ³΅μ κ±°
λκΈλ¨κΈ°κΈ°