zoukankan      html  css  js  c++  java
  • SQL-43 将所有to_date为9999-01-01的全部更新为NULL,且 from_date更新为2001-01-01。

    题目描述

    将所有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);

    insert into titles_test values ('1', '10001', 'Senior Engineer', '1986-06-26', '9999-01-01'),
    ('2', '10002', 'Staff', '1996-08-03', '9999-01-01'),
    ('3', '10003', 'Senior Engineer', '1995-12-03', '9999-01-01'),
    ('4', '10004', 'Senior Engineer', '1995-12-03', '9999-01-01'),
    ('5', '10001', 'Senior Engineer', '1986-06-26', '9999-01-01'),
    ('6', '10002', 'Staff', '1996-08-03', '9999-01-01'),
    ('7', '10003', 'Senior Engineer', '1995-12-03', '9999-01-01');
    SQL:
    update titles_test set to_date=null,from_date='2001-01-01'
    where to_date='9999-01-01'
    

      

  • 相关阅读:
    2019春招面试题总结-03
    2019春招面试题总结-02
    2019春招面试题总结-01
    Node.js 全局对象
    Node.js 路由
    Node.js 函数
    Node.js 模块系统
    Node.js Stream(流)
    Node.js Buffer(缓冲区)
    Node.js EventEmitter
  • 原文地址:https://www.cnblogs.com/kexiblog/p/10736716.html
Copyright © 2011-2022 走看看