牛客SQL练习第43题

tech2025-02-12  10

题目描述

将所有to_date为9999-01-01的全部更新为NULL,且 from_date更新为2001-01-01。

CREATE TABLE IF NOT EXISTS titles_test ( id int(11) not null primary key, emp_no int(11) NOT NULL, title varchar(50) NOT NULL, from_date date NOT NULL, to_date date DEFAULT NULL);

解答

update titles_test set to_date=null,from_date='2001-01-01' where to_date='9999-01-01'

set 字段名1=字段值1,字段名2=字段值2 ,用逗号","分隔,不是用空格分隔s

最新回复(0)