Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to modify all data of a field in mysql data table
How to modify all data of a field in mysql data table
Update statement can be used to modify all data of a field in mysql data table. The syntax is:

Update table _ name set column = value [,column = value...] [where condition];

Some parts in [] may or may not be.

For example:

Update the student set stu_name = "Zhang San", stu_gender = "m "where stu _ id = 5;;

Extended data:

Summary of SQL modifying field properties:

1. Modify the field type in the table to modify the column type, whether it is empty or not)

Alter table[ table name ]alter column[ column name] type

2. Add fields to the table

Alter table[ table name ]add[ column name] type

3. Delete fields

Alter table[ table name ]drop column[ column name]

4. Add a primary key

Alter table[ table name ]add constraint[ constraint name] primary key ([column name])

5. Add a unique constraint

Alter table [table name] add constraint [constraint name] unique ([column name])

6. Add the default value of a column in the table.

Alter table[ table name ]add constraint[ constraint name ]default for[ column name].