在 Derby DB 中,是否可以使用单个查询添加多个列?
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是在一份声明中。但是您可以在单个事务中发出多个 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...