- 查询一个表中有多少字段
select count(*) from user_tab_columns where table_name=upper('表名') #Oracle
select count(*) from information_schema.COLUMNS where table_name='person'; #mysql
- 查询某个约束名在那个表中
#Oracle
select * from user_cons_columns cl where cl.constraint_name = '约束名';
- 新增表的字段
ALTER TABLE 表名 ADD 字段名 VARCHAR(5) COMMENT '注释内容';
ALTER TABLE 表名 DROP COLUMN 字段名;