这里有一种非常快的建表方式,用As
我们根据查询结果创建表(查询的结果会添加到新创建的表中)
例如:
create table if not exists student3
as select id, name from student;
然后一个名为student3的表就被建立,并且有两个parameters: id 和 name。其数据类型和student表一样,且student表中每一行的数据也被拷贝到student3中。可以用 show tables 和 select * from student3查看数据。