database - Difference between NOT NULL constraint and CHECK(attr is not null) -


i wanted create outline constraint alter key(not null + unique), think not null constraint can't placed outline, therefore, think have options:

  • outline constraint: check(attr not null)
  • in-line constraint not null + outline constraint unique(attr)

is there difference between set in-line constraint not null column , add constraint check (column not null)?

thanks in advance

defining column not null preferred approach. indicate in dba_tab_cols, all_tab_cols, , user_tab_cols data dictionary view, example, column not nullable. conventional approach future developers more expect not null constraints defined on columns cannot null.

just define unique constraints along not null constraints rather creating primary key constraints, define check constraints rather not null constraints. both approaches work in same way functional standpoint. data dictionary views display approaches differently tools rely on data dictionary may behave differently. , conventional approaches more future developers see , expect rather being surprised by.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -