create table person(
number int (4) auto_increment primary key,
name varchar (50) not null,
sex char (2) ,
bornDate datetime
);
//创建表名为Person的表
alter table `student` add constraint `pk_studen` primary key `student` (`id`);
alter table `student` add constraint `fk_stdent_grade` foreign key (`grade id`) references `grade` (`id`);
alter 旧表明 rename 新表明
alter table 表名 add 字段民 数据类型 (属性)
alter table 表明 change 原字段名 新字段名 数据类型 属性
删除 字段 alter table 表明 drop 字段名
插入 insert into 新表 (字段名列表) values (值列表1 ,值列表2)
1 将查询结果插入新表
insert into 新表 字段
select 字段一 字段二
from 原表
2 将查询结果插入新表
select 字段一 字段额
into 新表
from 原表
转载请注明原文地址: https://ju.6miu.com/read-675770.html