Vertica SQL 在一条语句中插入多行 [英] Vertica SQL insert multiple rows in one statement
本文介绍了Vertica SQL 在一条语句中插入多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想知道是否可以在一个插入语句中完成以下操作?
Was wondering whether it's possible to accomplish the following in one insert statement?
drop table analytics.bw_covariance_matrix;
create table analytics.bw_covariance_matrix (
row int,
x1 float,
x2 float,
x3 float
);
insert into analytics.bw_covariance_matrix VALUES
(1, 4.01926965, -0.4686067, -0.07592112),
insert into analytics.bw_covariance_matrix VALUES
(2, -0.46860675, 4.1799267, -0.82461139);
insert into analytics.bw_covariance_matrix VALUES
(3, -0.07592112, -0.8246114, 4.37186211);
推荐答案
你可以 UNION
一个 SELECT 有一个 INSERT
语句:
You could UNION
a SELECT to have a single INSERT
statement:
insert into analytics.bw_covariance_matrix
SELECT 1, 4.01926965, -0.4686067, -0.07592112
UNION
SELECT 2, -0.46860675, 4.1799267, -0.82461139
UNION
SELECT 3, -0.07592112, -0.8246114, 4.37186211
我不相信 Vertica 有像 MySQL 和其他 RDBMS 那样的多记录插入语句,所以这是最好的选择.
I don't believe that Vertica has a multi record insert statement like MySQL and other RDBMS's, so this is the best bet.
这篇关于Vertica SQL 在一条语句中插入多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文