Reputation: 1
This may be a silly question so do forgive me. Im making up a table that has these columns id, name, email and sent.. I need the sent value to be 1 as default.. its for a mailing list so obviously if the user inputs data into the form and submits it they would like to be mailed.. Is it best to set it as "as defined" and set it to 1, or is there another way?
Thanks in advance.
Upvotes: 0
Views: 64
Reputation: 1319
ALTER TABLE yourtablename ADD COLUMN sent INT DEFAULT 1;
This will set the default value to 1 for the table altered. Just specify your table name and the data type that fits your needs as opposed to "INT".
Upvotes: 1