常用sql記錄

2022-07-24 02:06:10 字數 387 閱讀 6121

一、修改字段預設值

alter table 表名 drop constraint 約束名字   ------說明:刪除表的字段的原有約束

alter table 表名 add constraint 約束名字 default 預設值 for 欄位名稱 -------說明:新增乙個表的字段的約束並指定預設值

二、修改欄位名:

alter table 表名 rename column a to b

三、修改字段型別:

alter table 表名 alter column unitprice decimal(18, 4) not null 

三、修改增加字段:

alter table 表名 add 字段 型別 not null default 0

oracle 常用sql記錄

以下是在實際開發,運維系統時可能用到的sql.不定期更新.1.查詢已經刪除的表 select object name,original name,partition name,type,ts name,createtime,droptime from recyclebin 2.還原已經刪除的表 fl...

常用sql語句記錄 持續更新

常規表空間使用率查詢 select to char sysdate,yyyy mm dd hh24 mi ss from dual prompt tablespace set linesize 120 set pagesize 10000 col tablespace format a20 sele...

mysql常用sql語句記錄1

1.解決返回值為null的問題 假設name,addr返回的值中可能存在null值 select id,name,addr from tabe1 where id 1 修改的後的sql為 select id,case when name is null then else name end as n...