要在列中插入多个值,语法如下:
insert into yourTableName values(yourValue1),(yourValue2),..........N;
要了解上述语法,让我们创建一个表-
create table DemoTable2022
-> (
-> Department varchar(100)
-> );
使用插入命令在表中插入一些记录-
insert into DemoTable2022 values('Computer Science'),('Information Technology'),
('Civil'),('Mechanical'),('Electronics'),('Electrical');
Records: 6 Duplicates: 0 Warnings: 0
使用select语句显示表中的所有记录-
select *from DemoTable2022;
这将产生以下输出-
+---------------------------+
| Department |
+---------------------------+
| Computer Science |
| Information Technology |
| Civil |
| Mechanical |
| Electronics |
| Electrical |
+---------------------------+
6 rows in set (0.00 sec)