사이트 내 전체검색
PHP
[mysql] 데이터 수정하기
로빈아빠
https://cmd.kr/php/388 URL이 복사되었습니다.

본문

->UPDATE 테이블명 SET 필드명=필드값 또는 산술식 {, 필드명 = 필드값 또는 산술식}*

[WHERE 검색조건]
mysql> select * from testtable;

->uid 4 번의 데이터에 name 값과 email을 입력해 봄

mysql> update testtable set name = 'jjichangkyu' where age = 24;

mysql> update testtable set email = 'jiji177@naver.com' where age = 24;

mysql> select * from testtable;

 

-> uid 1 인 사람 (parksungsoo)의 나이를 25살로 수정

mysql> update testtable set age= 25 where uid =1;

 

->uid 2인 사람의 나이를 30살로 수정

mysql> update testtable set age = 30 where uid =2;

mysql> update testtable set age = 41 where uid=3;

 

-> 한해가 지났으므로 모든 사람의 나이를 한 살씩 증가

mysql> update testtable set age = age + 1;

mysql> select * from testtable;

 

댓글목록

등록된 댓글이 없습니다.

PHP
871 (7/18P)

Search

Copyright © Cmd 명령어 3.141.35.16