본문 바로가기
카테고리 없음

DATABASE2 MySQL - 12.UPDATE - ongoing

by 남산고라니 2021. 10. 13.
반응형
mysql> ----------------------------------------
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--------------------------------------' at line 1
mysql> DESC topic;
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int          | NO   | PRI | NULL    | auto_increment |
| title       | varchar(100) | NO   |     | NULL    |                |
| description | text         | YES  |     | NULL    |                |
| created     | datetime     | NO   |     | NULL    |                |
| author      | varchar(30)  | YES  |     | NULL    |                |
| profile     | varchar(100) | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.01 sec)

mysql> SELECT * FROM topic;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title      | description       | created             | author | profile                   |
+----+------------+-------------------+---------------------+--------+---------------------------+
|  1 | MySQL      | MySQL is ...      | 2021-10-13 19:58:34 | egoing | developer                 |
|  2 | ORCALE     | ORCALE is ...     | 2021-10-13 20:13:20 | egoing | developer                 |
|  3 | SQL Server | SQL Server is ... | 2021-10-13 20:13:28 | duru   | database administrator    |
|  4 | PostgreSQL | PostgreSQL is ... | 2021-10-13 20:13:35 | taeho  | data sicentist, developer |
|  5 | MongoDB    | MongoDB is ...    | 2021-10-13 20:13:40 | egoing | developer                 |
+----+------------+-------------------+---------------------+--------+---------------------------+
5 rows in set (0.00 sec)

mysql> UPDATE topic SET profile='data scientist, developer' WHERE id='4';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM topic
    -> ;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title      | description       | created             | author | profile                   |
+----+------------+-------------------+---------------------+--------+---------------------------+
|  1 | MySQL      | MySQL is ...      | 2021-10-13 19:58:34 | egoing | developer                 |
|  2 | ORCALE     | ORCALE is ...     | 2021-10-13 20:13:20 | egoing | developer                 |
|  3 | SQL Server | SQL Server is ... | 2021-10-13 20:13:28 | duru   | database administrator    |
|  4 | PostgreSQL | PostgreSQL is ... | 2021-10-13 20:13:35 | taeho  | data scientist, developer |
|  5 | MongoDB    | MongoDB is ...    | 2021-10-13 20:13:40 | egoing | developer                 |
+----+------------+-------------------+---------------------+--------+---------------------------+
5 rows in set (0.00 sec)

mysql> UPDATE topic SET title='Oracale' WHERE id='2';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> UPDATE topic SET title='Oracale' WHERE id='2';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> SELECT * FROM topic
    -> ;
+----+------------+-------------------+---------------------+--------+---------------------------+
| id | title      | description       | created             | author | profile                   |
+----+------------+-------------------+---------------------+--------+---------------------------+
|  1 | MySQL      | MySQL is ...      | 2021-10-13 19:58:34 | egoing | developer                 |
|  2 | Oracale    | ORCALE is ...     | 2021-10-13 20:13:20 | egoing | developer                 |
|  3 | SQL Server | SQL Server is ... | 2021-10-13 20:13:28 | duru   | database administrator    |
|  4 | PostgreSQL | PostgreSQL is ... | 2021-10-13 20:13:35 | taeho  | data scientist, developer |
|  5 | MongoDB    | MongoDB is ...    | 2021-10-13 20:13:40 | egoing | developer                 |
+----+------------+-------------------+---------------------+--------+---------------------------+
5 rows in set (0.00 sec)

mysql> ################
mysql> ########################################################################################
mysql>

WHERE id='2'를 안쓰면....재앙....메모....

반응형

댓글