您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何借助 MySQL 自计算输出将值插入表中?

2024/4/6 12:29:30发布34次查看
我们可以通过mysql返回的自计算输出将值插入到表中。在这种情况下,我们不需要使用虚拟的“dual”表。语法可以如下所示:
insert into table_name(column1,column2,column3,…) select value1,value2,value3,…;
example在下面的示例中,我们使用mysql自计算的输出将值插入到'testing'表中。
mysql> create table testing(id int, item_name varchar(10));query ok, 0 rows affected (0.15 sec)mysql> insert into testing (id,item_name)select 1,'book';query ok, 1 row affected (0.11 sec)records: 1 duplicates: 0 warnings: 0mysql> insert into testing (id,item_name)select 2,'pen';query ok, 1 row affected (0.11 sec)records: 1 duplicates: 0 warnings: 0mysql> select * from testing;+------+-----------+| id | item_name |+------+-----------+| 1 | book || 2 | pen |+------+-----------+2 rows in set (0.00 sec)
以上就是如何借助 mysql 自计算输出将值插入表中?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product