Oracle上的約束簡介
約束簡介
1、? 約束有以下幾種類型
Not Null
Unique
Primary Key
Foreign Key
Check
以上幾個約束,與 SQL Server 的標準一致 , 不再解釋。
2、? 添加約束
舉例:
Alter table employees Add constraint emp_manager_fk ? Foreign key(manager_id) references employees(employee_id); |
3、? 刪除約束
Alter table employees Drop constraint emp_manager_fk; |
4、? 使約束無效
舉例:
Alter table employees Disable constraint emp_emp_id_pk casecade; |
5、? 使約束有效
舉例:
Alter table employees Enable constraint emp_emp_id_pk; |
6、? 查看約束
舉例 1 :查看表的所有約束:
Select constraint_name,constraint_type,search_condition From user_constraints Where table_name=’EMPLOYEES’; |
??????
????????????? 舉例 2 :查看約束關聯的列
select constraint_name,column_name from user_cons_columns where table_name='TFLOW' |
posted on 2006-06-06 23:28 MingIsMe 閱讀(187) 評論(0) 編輯 收藏 所屬分類: 10 Database