티스토리 뷰
mysql delete문 실습
MariaDB [opentutorials]> select * from topic;
+----+---------+---------------+---------------------+--------+-------------------------+
| id | title | description | created | author | profile |
+----+---------+---------------+---------------------+--------+-------------------------+
| 1 | mysql | mysql is... | 2018-09-21 21:26:22 | egoing | developer |
| 2 | oracle | oracle is.. | 2018-09-21 21:30:37 | egoing | devloper |
| 3 | sql | sql is... | 2018-09-21 21:32:08 | duru | data administator |
| 4 | postsql | postsql is... | 2018-09-21 21:36:45 | taeho | data scientist devloper |
| 5 | mongodb | mongdb is.. | 2018-09-21 21:37:55 | egoing | devloper |
+----+---------+---------------+---------------------+--------+-------------------------+
5 rows in set (0.00 sec)
주의 delete 문에서 where가 빠지면 인생이 바뀐다고 그런다.
where가 빠지면 모두 삭제되는거임.
MariaDB [opentutorials]> delete from topic where id = 5;
Query OK, 1 row affected (0.01 sec)
MariaDB [opentutorials]> select * from topic;
+----+---------+---------------+---------------------+--------+-------------------------+
| id | title | description | created | author | profile |
+----+---------+---------------+---------------------+--------+-------------------------+
| 1 | mysql | mysql is... | 2018-09-21 21:26:22 | egoing | developer |
| 2 | oracle | oracle is.. | 2018-09-21 21:30:37 | egoing | devloper |
| 3 | sql | sql is... | 2018-09-21 21:32:08 | duru | data administator |
| 4 | postsql | postsql is... | 2018-09-21 21:36:45 | taeho | data scientist devloper |
+----+---------+---------------+---------------------+--------+-------------------------+
4 rows in set (0.01 sec)
'프로그래밍 > C#' 카테고리의 다른 글
mysql join 실습 예제 (0) | 2018.09.22 |
---|---|
mysql 테이블 분리하기 (0) | 2018.09.22 |
mysql update 문 실습 (0) | 2018.09.21 |
mysql select문 실습 (0) | 2018.09.21 |
mysql 테이블 insert 실습 (0) | 2018.09.21 |