简体   繁体   English

在MonetDBLite中向表添加变量

[英]Add a variable to a table in MonetDBLite

Here is mtcars data in the MonetDBLite database file. 这是MonetDBLite数据库文件中的mtcars数据。

library(MonetDBLite)
library(tidyverse)
library(DBI)

dbdir <- getwd()
con <- dbConnect(MonetDBLite::MonetDBLite(), dbdir)

dbWriteTable(conn = con, name = "mtcars_1", value = mtcars)

data_mt <- con %>% tbl("mtcars_1")

dbSendQuery(con, "ALTER TABLE mtcars_1 ADD COLUMN new=2")

How should I add a column/variable "new" to the table mtcars_1 in the MonetDBLite? 如何在MonetDBLite的表mtcars_1中添加列/变量“新”?

尝试

dbSendQuery(con, "ALTER TABLE mtcars_1 ADD COLUMN new_col INTEGER DEFAULT 2")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM