Q
Problem solve Get help with specific problems with your technologies, process and projects.

Make new columns null?

I am trying to add four new colums to an already existing table with 960 records. Do I need to make these columns null or not null and why? These new columns will only be used by some Web templates and not all.

I am trying to add four new colums to an already existing table with 960 records. Do I need to make these columns null or not null and why? These new columns will only be used by some Web templates and not all.

Whether a column is NULL or NOT NULL depends on your business rules. Is the data required? Then the column should have a NOT NULL constraint. Is the data optional? Then the column should have a NULL constraint. The constraint enforces the business rule. Oracle does not determine the business rules for you. That is up to you.

If you add these new columns, the intial value for the column will be NULL unless you also specify a DEFAULT value for the column. If you do not specify a default value, then you will not be able to set this column as NOT NULL due to the conflict. You can't tell it to be NOT NULL and then let it be NULL because you did not provide a default.

Let your business rule determine the constraint type and then handle it appropriately when you add the column to the table.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close