So i have this table:
mysql> SELECT * FROM artists LIMIT 5;
---- ---------------- ------------ ---------- ---------------- -------- --------
| id | name | start_year | end_year | origin | type | gender |
---- ---------------- ------------ ---------- ---------------- -------- --------
| 4 | Massive Attack | 1987 | NULL | United Kingdom | Group | NULL |
| 17 | Bob Dylan | 1941 | NULL | United States | Person | Male |
| 20 | Art of Noise | 1983 | 2000 | United Kingdom | Group | NULL |
| 25 | Pavement | 1989 | 2000 | United States | Group | NULL |
| 29 | Stevie Wonder | 1950 | NULL | United States | Person | Male |
---- ---------------- ------------ ---------- ---------------- -------- --------
mysql> SELECT name, end_year FROM artists WHERE name IN ("Black Box Recorder");
-------------------- ----------
| name | end_year |
-------------------- ----------
| Black Box Recorder | 2010 |
-------------------- ----------
I then make the table smaller to show what i want to rename which is the end year, and i want to change it to NULL. I have tried this command:
UPDATE artists SET end_year='NULL' WHERE name='Black Box Recorder';
and i thought this command should be correct but it gives this error:
ERROR 1366 (HY000): Incorrect integer value 'NULL' for column 'end_year' at row 155
CodePudding user response:
Please remove quotes from 'NULL' in your update statement.
UPDATE artists SET end_year=NULL WHERE name='Black Box Recorder';
CodePudding user response:
NULL not equal varchar2,so you should try end_year=NULL