개발 여정/DataBase (MySQL)
MySQL :: UPDATE (내용 변경하기)
calm-lee
2021. 9. 3. 18:50
테이블 내용 변경하기 - UPDATE문 이용
ㅁ 공식
update `테이블` // 내용 변경할 테이블
set
`열` = '값' // 바꿀 내용
where `열` = '값'; // 조건
ㅁ 예
ex) `student` 테이블에서 홍길동 학생의 2019년 2학기 수학 성적을 85로 수정하세요.
update `student`
set
`score` = 85
, `updatedAt` = now() // 업데이트하는 시점도 표기
where
`name` ='홍길동' and `year` = '2019' and `semester` = '2' and subject = '수학'; // 조건