-
table에서 create, select, update, delete , insert, drop하기Data Base/MySQL 2007. 11. 21. 18:29
UPDATE문
====================================================================
update [테이블 이름] set [필드1] = [값1], [필드2]=[값2] ,..where [조건]
====================================================================
mysql> select * from MEMBER;
+----------+----------+--------+-------+
| MEMBERID | PASSWORD | NAME | EMAIL |
+----------+----------+--------+-------+
| binian | 1234 | 한성빈 | NULL |
| happy | qwer | 강'군 | NULL |
+----------+----------+--------+-------+
mysql> update MEMBER set EMAIL='happynewmind@hotmail.com' where NAME='한성빈';
Query OK, 1 row affected (0.16 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> select * from MEMBER;
+----------+----------+--------+--------------------------+
| MEMBERID | PASSWORD | NAME | EMAIL |
+----------+----------+--------+--------------------------+
| binian | 1234 | 한성빈 | happynewmind@hotmail.com |
| happy | qwer | 강'군 | NULL |
+----------+----------+--------+--------------------------+
2 rows in set (0.00 sec)mysql> update MEMBER set EMAIL='kangkun@hotmail.com' where NAME="강'군";
Query OK, 1 row affected (0.08 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> select * from MEMBER;
+----------+----------+--------+--------------------------+
| MEMBERID | PASSWORD | NAME | EMAIL |
+----------+----------+--------+--------------------------+
| binian | 1234 | 한성빈 | happynewmind@hotmail.com |
| happy | qwer | 강'군 | kangkun@hotmail.com |
+----------+----------+--------+--------------------------+
2 rows in set (0.00 sec)'Data Base > MySQL' 카테고리의 다른 글
한글 깨짐을 server.xml로 제어하는 방법 (0) 2007.11.23 MySQL 한글깨짐 방지 및 처리 (0) 2007.11.22 MySQL 명령어 (0) 2007.11.22 SQL 타입과 설명 (0) 2007.11.21 MySQL 접속 및 테이블 생성예제 (0) 2007.11.21 MySQL 데이터베이스 추가 (0) 2007.11.21 MySQL 설치하기 (0) 2007.11.21