update sql
时间: 2023-06-28 18:15:01 浏览: 97
update.sql
UPDATE is a SQL statement used to modify the existing records in a table. The basic syntax for updating a table is as follows:
```
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
```
- `table_name`: the name of the table to be updated
- `column1`, `column2`: the names of the columns to be updated
- `value1`, `value2`: the new values to be set for the specified columns
- `WHERE`: a condition that specifies which records to update. If no `WHERE` clause is specified, all records in the table will be updated.
For example, to update the `age` column of the `students` table where the `id` is 1:
```
UPDATE students SET age = 20 WHERE id = 1;
```
This will set the `age` of the student with `id` 1 to 20.
阅读全文