A learner here. This has to be esasy but I cannot figure it out.
I have a table like this:
ID -- NAME -- CHOICE
1 -- John -- book
2 -- Matt -- pen
3 -- Linda -- bag
.
.
What would be the script to turn all the data in column CHOICE to null?
Thanks a ton
UPDATE [table] SET [column]=0 WHERE [column] IS NULL; Null Values can be replaced in SQL by using UPDATE, SET, and WHERE to search a column in a table for nulls and replace them.
First, specify the table name that you want to change data in the UPDATE clause. Second, assign a new value for the column that you want to update. In case you want to update data in multiple columns, each column = value pair is separated by a comma (,). Third, specify which rows you want to update in the WHERE clause.
Right-click the column you want to delete and choose Delete Column from the shortcut menu. If the column participates in a relationship (FOREIGN KEY or PRIMARY KEY), a message prompts you to confirm the deletion of the selected columns and their relationships. Choose Yes.
You'd use an UPDATE statement, without a WHERE clause (so it updates every single row)
UPDATE YourTable
SET Choice = NULL
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