I have a SQL database table I need to add a column to. Once that column is added I need to give all rows a one-time specified value for the added column; I know to add the column I could use the following:
// Adds a column to the table
"ALTER TABLE myTable ADD lastCheck INT;"
From here I'm left with looping through a 15+k row table using php. Is there a better/faster way to do this without having to depend on PHP as the work horse?
A few notes:
1: After the initial setting of the column row's value, values can be null, so specifying a default is out of the question.
Try this
ALTER TABLE myTable ADD lastCheck INT DEFAULT 10
OR you can run an update afterward
UPDATE MyTable SET lastCheck = 10