在 Derby DB 中,是否可以使用单个查询添加多个列?

发布于 2024-11-18 10:05:50 字数 259 浏览 3 评论 0原文

在 Derby DB 中,是否可以使用单个查询添加多个列?

以下是我尝试过但没有成功的查询。

ALTER TABLE <table_name>
  ADD (COLUMN col_1 VARCHAR(2), COLUMN col_2 VARCHAR(2));

ALTER TABLE <table_name>
  ADD COLUMN (col_1 VARCHAR(2), col_2 VARCHAR(2));

In Derby DB, is it possible to add multiple columns using single query?

The following are the queries I tried but didn't work.

ALTER TABLE <table_name>
  ADD (COLUMN col_1 VARCHAR(2), COLUMN col_2 VARCHAR(2));

ALTER TABLE <table_name>
  ADD COLUMN (col_1 VARCHAR(2), col_2 VARCHAR(2));

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

a√萤火虫的光℡ 2024-11-25 10:05:50

不是在一份声明中。但是您可以在单个事务中发出多个 DDL 语句,就像常规 UPDATE-s 一样。然后,更改将以原子方式“发生”(在事务外变得可见):同时,全部或全部不发生。

或者,语句只需要用分号分隔,因此如果您想要的话,可以在一行中输入...

Not in one statement. But you can issue multiple DDL statements in a single transaction, just like regular UPDATE-s. Then the changes will "happen" (become visible outside the transaction) atomically: at the same time, all or nothing.

Alternatively, statements only need be separated by a semicolon, thus can be typed in one line if that's what you are after...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文