0

Hi to all,

Example:
CREATE TABLE test(name varchar(20) NOT NULL DEFAULT '');

In the above query varchar is described as NOT NULL.Then why we are inserting DEFAULT value as '' (null).

Thanks in advance,
Prem

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by pritaeas
0

It is not the same, NULL means no value, '' means an empty string (although no characters, it is still a string value).

0

If you not mentioned the DEFAULT AS ''(empty string) in VARCHAR. It automatically inserting the empty string.Then, What is the purpose of mentioning DEFAULT AS ''(empty string).

0

If you not mentioned the DEFAULT AS ''(empty string) in VARCHAR. It automatically inserting the empty string.Then, What is the purpose of mentioning DEFAULT AS ''(empty string).

The default value of '' will be inserted into the column if it is not in your query.

0

What is the purpose of inserting empty string in varchar..If u not mentioned empty string ,the sql will insert empty string as default.

Is it mandatory to insert the "Default as Empty String" in Query.

0

Is it mandatory to insert the "Default as Empty String" in Query.

No, it is not. You can choose to add it, and you can then choose any string as default. If you omit it, NULL is the default value.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.