Deleting one item from one row?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Deleting one item from one row?

Post by cturner »

I am wondering if someone could please tell me how I can delete one item from one row with mysql? Thanks in advance.
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post by GM »

Code: Select all

UPDATE table_name SET item_to_delete = NULL WHERE ...
The WHERE statement needs to contain a combination of columns/values that uniquely identify the row you need to change.

If NULL doesn't work, it means the column is set up to not accept NULL, in which case the best you can do is to change it to '' (blank string), or 0 (in case of integer)
Post Reply