0

In my database, is it standard to leave most fields with default value "none"? For example a user id, a post title, category, or tags.

2 Answers 2

1

For required fields such as username or password, you should set NOT NULL. For other optional fields you can set it to NULL. For numbers, it is almost always a good idea to set default value to zero 0 .

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks!! By NOT NULL do you mean just set the default to none and null to no?
@CyberJunkie: yeah you can interpret that way :)
1

I'll answer your question as I best understand it.

For User_id, it is common to set its default value to auto_increment. SQL will automatically fill this in when you create a new record.

Text fields will default to null, although when you create the table you can set a DEFAULT such as ' ', 'cat' or anything else you like.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.