Home > Archive > MySQL > πŸ‹[MySQL] ν…Œμ΄λΈ”μ— 데이터 μž…λ ₯ INSERT INTO

πŸ‹[MySQL] ν…Œμ΄λΈ”μ— 데이터 μž…λ ₯ INSERT INTO
MySQL

INSERT INTO

memberTBLμ΄λΌλŠ” ν…Œμ΄λΈ”μ΄ μžˆμŠ΅λ‹ˆλ‹€.

κ·Έ ν…Œμ΄λΈ”μ—λŠ” μ•„λ¬΄λŸ° 데이터가 μž…λ ₯λ˜μ§€ μ•Šμ€ μƒνƒœμž…λ‹ˆλ‹€.

μ—΄(Column, ν•„λ“œ)은 총 3κ°œμž…λ‹ˆλ‹€.

  • memberID
    • char(8)
  • memberName
    • char(5)
  • memberAddress
    • char(20)

데이터λ₯Ό ν•œ ν–‰(row)을 μ‚½μž…ν•˜λ €κ³  ν•  κ²½μš°μ—λŠ” λ‹€μŒκ³Ό κ°™μ΄ν•˜λ©΄ λ©λ‹ˆλ‹€.

INSERT INTO ν…Œμ΄λΈ”μ΄λ¦„ VALUES (데이터1, 데이터2, 데이터3...);

λ§Œμ•½ memberTBL에 ν•œ ν–‰(row)을 μ‚½μž…ν•˜λ € ν•  κ²½μš°λŠ” λ‹€μŒκ³Ό κ°™μ΄ν•˜λ©΄ λ©λ‹ˆλ‹€.

INSERT INTO memberTBL VALUES ('Thomas', 'ν† λ§ˆμŠ€', 'κ²½κΈ° λΆ€μ²œμ‹œ 쀑동');

λ§Œμ•½ νŠΉμ • ν•„λ“œμ—λ§Œ 값을 μž…λ ₯ν•˜κ³  싢을 κ²½μš°μ—λŠ” VALUES μ•žμ— β€œμž…λ ₯ν•  ν•„λ“œλ₯Ό μ„ μ–Έν•΄ μ€λ‹ˆλ‹€.”

INSERT INTO memberTBL (memberID, memberAddress) VALUES ('Thomas', 'κ²½κΈ° λΆ€μ²œμ‹œ 쀑동');

λ§Œμ•½ μ—¬λŸ¬ 개의 ν–‰(row)을 λ™μ‹œμ— μž…λ ₯ν•˜κ³  싢을 κ²½μš°μ—λŠ” μ•„λž˜μ™€ 같이 μ—¬λŸ¬ 개의 행을 λ™μ‹œμ— μž…λ ₯이 κ°€λŠ₯ν•©λ‹ˆλ‹€.

INSERT INTO memberTBL (memberID, memberName, memberAddress) VALUES  ('Thomas', 'ν† λ§ˆμŠ€', 'κ²½κΈ° λΆ€μ²œμ‹œ 쀑동'), ('Edward', 'μ—λ“œμ›Œλ“œ', 'μ„œμšΈ 은평ꡬ 증산동'), ('Henrv', '헨리', '인천 남ꡬ μ£Όμ•ˆλ™'), ('Gorden', 'κ³ λ“ ', 'κ²½κΈ° μ„±λ‚¨μ‹œ 뢄당ꡬ');