1. 程式人生 > 其它 >SQL45 將titles_test表名修改為titles_2017

SQL45 將titles_test表名修改為titles_2017

描述

將titles_test表名修改為titles_2017。
CREATETABLEIFNOTEXISTStitles_test(
idint(11)notnullprimarykey,
emp_noint(11)NOTNULL,
titlevarchar(50)NOTNULL,
from_datedateNOTNULL,
to_datedateDEFAULTNULL);

insertintotitles_testvalues('1','10001','SeniorEngineer','1986-06-26','9999-01-01'),
('2','10002','Staff','1996-08-03','9999-01-01'),
('3','10003','SeniorEngineer','1995-12-03','9999-01-01'),
('4','10004','SeniorEngineer','1995-12-03','9999-01-01'),
('5','10001','SeniorEngineer','1986-06-26','9999-01-01'),
('6','10002','Staff','1996-08-03','9999-01-01'),
('7','10003','SeniorEngineer','1995-12-03','9999-01-01');
ALTER TABLE titles_test RENAME TO titles_2017