user1619397
user1619397

Reputation: 730

SQL table Column defaut to Nullable

Is Nullable set as default for the column? So if you create new column in the table and not set something like nullable="true", should it be default to nullable? And the auto generated value the column will be Null?

Upvotes: 0

Views: 35

Answers (2)

Drew Guidry
Drew Guidry

Reputation: 3

It depends on the RDBMS you're using, but in SQL Server:

Unless the field you're creating is the primary key for the table or you specify otherwise, it defaults to NULLs allowed and the default value will be NULL.

Upvotes: 0

Naveen
Naveen

Reputation: 947

Yes, when you create new column, if you don't specify NOT NULL as below, then column is populated with null value as a default.

created_by VARCHAR2(50) NOT NULL

Upvotes: 1

Related Questions