如何从表中选择数据并插入到另一个表中? [英] How to select data from a table and insert into another table?

查看:235
本文介绍了如何从表中选择数据并插入到另一个表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在cassandra中选择表的特定字段,并将它们插入到另一个表中。我在sql服务器这样做这样:

I want to select specific fields of a table in cassandra and insert them into another table. I do this in sql server like this:

INSERT INTO Users(name,family)
SELECT name,family FROM Users

如何在cassandra-cli或cqlsh中执行此操作?

How to to this in cassandra-cli or cqlsh?

推荐答案

COPY keyspace.columnfamily1 (column1, column2,...) TO 'temp.csv';
COPY keyspace.columnfamily2 (column1, column2,...) FROM 'temp.csv';

这里给你的keyspace(schema-name),而不是columnfamilyname1使用你想要的表复制和在columnfamily2中给出您要复制的tablename。

here give your keyspace(schema-name) and instead of columnfamilyname1 use the table to which you want to copy and in columnfamily2 give the tablename in which you want to copy..

是的,这是CQL从未尝试过CLI的解决方案。

And yes this is solution for CQL never tried in with CLI..

这篇关于如何从表中选择数据并插入到另一个表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆