1 Star 0 Fork 52

gentlhoo / 数据库SQL实战

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
45.将titles_test表名修改为titles_2017.md 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
王鹏 提交于 2020-09-29 10:29 . 将titles_test表名修改为titles_2017

将titles_test表名修改为titles_2017

题目描述

将titles_test表名修改为titles_2017。

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');

答案

alter table titles_test rename to titles_2017

题解

MySQL语法:

alter table titles_test rename titles_2017
SQL
1
https://gitee.com/gentlhoo/database-sql-combat.git
git@gitee.com:gentlhoo/database-sql-combat.git
gentlhoo
database-sql-combat
数据库SQL实战
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891