I want to update all rows of a specific column on a table. I have a table
named user
and a column
named type
. I want to update
the data of all rows in column type
with the value faculty
.
Is this possible? How can I achieve this?
This will be your sql statement
sql = "UPDATE user SET type='faculty'";
then execute your sql statement
试试这个
mysql_query("update user set type = 'faculty'")or die();
use this query:
UPDATE user SET colum_name = "update_value" WHERE type= "faculty";
If you're using MySQL with PHP:
mysql_query("UPDATE user SET type = 'faculty'");
If you're using postgreSQL with PHP:
pg_query("UPDATE user SET type = 'faculty'");
Otherwise you can use
UPDATE user SET type = 'faculty'
with whichever SQL client you're using in the SQL query box.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.