SQL语句如何删除列?

2026年09月23日 07:38
有1个网友回答
网友(1):

1、创建测试表,create table test_cols(id number, id2 number, id3 number);

2、查看该表的字段名,select * from user_tab_columns t where table_name = upper('test_cols'),共有三列,

3、执行sql,删除一列ID2,alter table test_cols drop column id2,

4、再次查看该表的字段名,select * from user_tab_columns t where table_name = upper('test_cols'),只有两列,