首页 > 试题广场 >

有一张Course表包含如下数据: user_id cour

[单选题]
有一张Course表包含如下数据:
user_id
course_status
course_date
2 学习 Python
 2021-09-30

现要把Course表中user_id为2的course_status更新为'学习SQL',course_date更新为'2021-10-01'。下列MySQL语句中,正确的是:

  • UPDATE Course SET course_status = '学习SQL', course_date = '2021-10-01' ;

  • UPDATE Course SET course_status = '学习SQL' AND course_date = '2021-10-01' WHERE user_id = 2;

  • UPDATE Course SET course_status = REPLACE(course_status, '学习SQL', '2021-10-01') WHERE user_id = 2;

  • UPDATE Course SET course_status = '学习SQL', course_date = '2021-10-01' WHERE user_id = 2;

update语句更改多个字段的状态时,字段中间用逗号,不用and
发表于 2022-01-18 10:20:01 回复(0)
update语句更改多个字段的状态时,字段中间要用逗号分开,不用and
发表于 2022-03-17 20:45:16 回复(0)
1. 修改单表的记录
update 表名
set 列 = 新值, 列 = 新值, ...
where 筛选条件;

2. 修改多表的记录
sql92语法 (i.e., 只支持内连接):
update 表1 别名, 表2 别名
set 列 = 值, ...
where 连接条件
and 筛选条件;
sql99语法:
update 表1 别名
inner | left | right join 表2 别名
on 连接条件
set 列 = 值, ...
where 筛选条件;
发表于 2022-09-20 09:16:17 回复(0)
update语句更改多个字段的状态时,字段中间用逗号。
发表于 2022-01-23 15:54:43 回复(0)
update更改多个字段的时候#中间是逗号 中间是逗号
编辑于 2024-03-31 00:56:59 回复(0)
  • 使用逗号主要是为了列出多个相同类型的元素(如列名、表名或值)。
  • 使用AND主要是为了组合多个逻辑条件,确保所有条件同时满足。
编辑于 2024-03-01 02:54:13 回复(0)
update语句更改多个字段的状态时,字段中间用逗号,不用and
发表于 2023-02-28 19:39:54 回复(0)
UPDATE `table_name` SET `column1`=value1,`column2`=value2,... WHERE `some_column`=some_value;
发表于 2022-04-08 09:46:41 回复(0)