常用SQL语句(oracle)(1)

  1. 查询表结构
 - select COLUMN_NAME,DATA_TYPE,DATA_LENGTH from user_tab_cols where table_name='TEST';
 - desc 表名;
  1. 添加列
ALTER TABLE table_name ADD column_name datatype
  1. 修改表
UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
  1. 唯一性约束:alter table 表 add constraint cons_01 unique (列)
 alter table 表 add constraint cons_01 unique (列) 
  1. 返回唯一不同的值:
 select distinct ... from ...

猜你喜欢

转载自blog.csdn.net/weixin_40331101/article/details/82895748