Reputation: 13
Is it possible to define a default value using a where clause:
Name | Value
------| ------
Jeff | Green
Paul | Red
Seb | Blue
ALTER TABLE Blokes
MODIFY Name DEFAULT Green WHERE Name='Jeff'
Something along these lines.
(apologies for the poor formatting but I couldn't get the table to work)
Edit: I am looking to update future entries automatically using DEFAULT. The DB in use is Oracle.
Edit 2: I was unable to find what I needed so I have gone with the option to update the data in a php script.
Upvotes: 1
Views: 457
Reputation: 4844
You can add a computed column:
ALTER TABLE
Blokes
ADD Name AS (CASE WHEN Name ='Jeff' THEN 'N' ELSE Name END)
Upvotes: 1