手记

【备战春招】第七天+MySQL8.0零基础入门之从青铜到钻石

课程名称:MySQL8.0零基础入门之从青铜到钻石

课程章节:DDL语法3;蠕虫复制

课程讲师:欧阳熊猫

课程内容:

蠕虫复制:在已有的数据基础之上,将原来的数据进行复制,插入到对应的表中

创建student1表,结构与student相同

CREATE TABLE student1 LIKE student;

将student表中的数据复制到student1中(复制全部字段)

INSERT INTO student1 SELECT * FROM student;

SELECT * FROM student1;

复制部分字段

如只想复制student表中的name, address字段到student2中:

CREATE TABLE student2 LIKE student1;

INSERT INTO student2(name, address)SELECT nmae, address FROM student1;

SELECT * FROM student2;


0人推荐
随时随地看视频
慕课网APP