user2682649
user2682649

Reputation: 1

Table value that is set to 1 or can be made to be 1 as default

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

Answers (1)

Fastidious
Fastidious

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".

ALTER TABLE Syntax

Upvotes: 1

Related Questions