表结构如下:
1、table每列都插入数据
mysql>insert into students values(0,"lili","f",12,"13501665963");
Query OK, 1 row affected (0.04 sec)
2、同时插入多条数据
mysql>insert into students values(2,"kity","m",25,15101122005),(3,"jujo","m",2
1,15610055009),(4,"jojo","f",24,18701559960);
Query OK, 3 rows affected (0.03 sec)
Records: 3 Duplicates: 0 Warnings: 0
3、对指定列插入一条数据(未指定的列必须有默认值,否则会报错)
mysql>insert into students(name,sex,age)values("kaite","f",20);
Query OK, 1 row affected (0.05 sec)
4、选择其他表的数据插入另一张表(前提是:两张表有相同的字段(列))
teacher表插入数据前:
1)选择students表的name列插入到teacher表
mysql> insert into teacher (name)select name from students;
Query OK, 6 rows affected (0.04 sec)
Records: 6 Duplicates: 0 Warnings: 0
teacher表插入students表后