2
I have the table 'category' and a column 'id', and this column has more than 100 records.
How do I add a value to all these records? In case the value would be '3'.
2
I have the table 'category' and a column 'id', and this column has more than 100 records.
How do I add a value to all these records? In case the value would be '3'.
2
Whereas the field you want to update is called campo
:
UPDATE categoria
SET campo = 3
2
update categoria set coluna='3' where coluna != '3'
I imagine it’s something like that. This only works on the console or if vc disable mysql security, because it does not leave security
2
An instruction of the kind UPDATE - when you have records in the table and want to update them - it is done as follows through the Mysql:
UPDATE nome_tabela SET campo = valor
In your case, to update the value of all records you simply remove the clause WHERE - used to filter/restrict some records - and then just do a query similar to that:
UPDATE categoria SET campo = 3
2
Mysql Instruction:
UPDATE Categoria
SET Campo = 3
This causes all values in the "Field" column to be changed to "3".
If there is a need to do this for specific lines, the use of a conditional (WHERE
).
Hug.
Browser other questions tagged mysql sql-update
You are not signed in. Login or sign up in order to post.