๊ด€๋ฆฌ ๋ฉ”๋‰ด

C-log

๐Ÿ—ƒ๏ธ๋‚˜์˜ SQL : DELETE ๋ณธ๋ฌธ

DB/๐ŸฌMySQL

๐Ÿ—ƒ๏ธ๋‚˜์˜ SQL : DELETE

4:Bee 2023. 9. 11. 12:24
728x90

MariaDB [opentutorials]> SELECT * FROM topic;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title      | description       | created             | author | profile                   |
+----+------------+-------------------+---------------------+--------+---------------------------+
|  1 | MySQL      | MySQL is ...      | 2023-09-10 15:36:30 | egoing | developer                 |
|  2 | Oracle     | Oracle is ...     | 2023-09-10 15:51:16 | egoing | developer                 |
|  3 | SQL Server | SQL Server is ... | 2023-09-10 15:57:25 | duru   | data administrator        |
|  4 | PostgreSQL | PostgreSQL is ... | 2023-09-10 15:58:31 | taeho  | data scientist, developer |
|  5 | MongoDB    | MongoDB is ...    | 2023-09-10 15:59:20 | egoing | developer                 |
+----+------------+-------------------+---------------------+--------+---------------------------+
5 rows in set (0.000 sec)

 

์ง€๋‚œ ์‹œ๊ฐ„์˜ ์šฐ๋ฆฌ์˜ ์Šคํ‚ค๋งˆ๋Š” ์œ„์˜ ๋ชจ์Šต์„ ํ•˜๊ณ  ์žˆ๋‹ค. ์šฐ๋ฆฌ๋Š” UPDATE๋ฅผ ๋ฐฐ์› ์œผ๋‹ˆ ์ด์ œ ์‚ญ์ œํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ฐฐ์›Œ ๋ณด๋ ค๊ณ  ํ•œ๋‹ค.  ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๋ณด์ž.

DELETE FROM topic WHERE id = 5;

MariaDB [opentutorials]> DELETE FROM topic WHERE id = 5;
Query OK, 1 row affected (0.004 sec)

MariaDB [opentutorials]> SELECT * FROM topic;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title      | description       | created             | author | profile                   |
+----+------------+-------------------+---------------------+--------+---------------------------+
|  1 | MySQL      | MySQL is ...      | 2023-09-10 15:36:30 | egoing | developer                 |
|  2 | Oracle     | Oracle is ...     | 2023-09-10 15:51:16 | egoing | developer                 |
|  3 | SQL Server | SQL Server is ... | 2023-09-10 15:57:25 | duru   | data administrator        |
|  4 | PostgreSQL | PostgreSQL is ... | 2023-09-10 15:58:31 | taeho  | data scientist, developer |
+----+------------+-------------------+---------------------+--------+---------------------------+
4 rows in set (0.000 sec)

์ด์ œ ์šฐ๋ฆฌ๋Š” CRUD์˜ ๋ชจ๋“  ๋ถ€๋ถ„์„ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค.

728x90
Comments