I have one table. The table name is employee. I used below query.
delete department,name,bloodgroup from employee where employeeid=2;
But I am not able to delete this record alone. It is showing error. And I don't want to use update statement.
You can't delete single column entries with the delete
SQL command. Only complete rows.
You can use the update
command for that:
update employee
set department = null, name = null, bloodgroup = null
where employeeid=2;
The above solution won't work until NOT NULL constraint is dropped(removed) to do this:
ALTER TABLE employee;
ALTER COLUMN department DROP NOT NULL;
After this You can UPDATE the table as above
UPDATE employee SET department = null WHERE employeeid =2;
Hope this one helps Thank you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With