Update an sql column of all records

Asked

Viewed 261 times

0

I will try to be as specific as possible, if anyone can help me I really appreciate.

I need to know how to change information in a column of all database records.

For example: I have the database with the table "Users" and in this table there is a column called "Account". In this column is the information "Inactive" and I need to change to "Active", but of all the records at once. Is it possible to do this? I am using Phpmyadmin

  • yes, you just do the UPDATE without the WHERE, so it will update the whole table, to help with the sql itself edit your question and include the table structure

  • Perfect! I do it through PHP or your can do it directly in SQL?

  • You can do directly by SQL.

1 answer

1


Lucas,

You can update the desired field without the Where clause or you can do as per the code below, where you will have the desired effect by updating only the records you need:

update Users set Conta = 'Ativo' where Conta = 'Inativo';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.