1.11M Members

What if?

 
0
 

What if I set up a database table for an ad form that has optional fields. Do i need to select anything when creating rows for these fields other then the type?

 
0
 

If the fields are optional that is fine. In general regardless of the SQL implementation, you would set the corret data type and allow for NULL values to be stored in the event that no data is inserted in the particular field for the record.

 
0
 

If the fields are optional that is fine. In general regardless of the SQL implementation, you would set the corret data type and allow for NULL values to be stored in the event that no data is inserted in the particular field for the record.

How do I allow for NULL values to be stored. Do i select Null as DEFAULT or do I select the NULL check box when creating the row?

 
0
 

I beleive that for MySQL, the column allows for null values unless you specified not to allow (not NULL) null values when you create the table. If you did set it to not allow null values, you simple can use the alter statement to modify the field to allow null values.

 
0
 

I beleive that for MySQL, the column allows for null values unless you specified not to allow (not NULL) null values when you create the table. If you did set it to not allow null values, you simple can use the alter statement to modify the field to allow null values.

Sorry, im using phpMyAdmin to manage my tables. Are you familiar with phpMyAdmin? If so could you tell me what to select. Such as NULL under DEFAULT or select the NULL checkbox?

LastMitch
Deleted Member
 
0
 

Sorry, im using phpMyAdmin to manage my tables. Are you familiar with phpMyAdmin?

Did you read the links I provided.

There's query you can enter in the phpMyAdmin if you want to do it that way.

 
0
 

Did you read the links I provided.

There's query you can enter in the phpMyAdmin if you want to do it that way

I did but it still doesn't explain when to use NULL as DEFAULT or when to click the NULL checkbox in phpMyAdmin.

LastMitch
Deleted Member
 
0
 

NULL as DEFAULT or when to click the NULL checkbox in phpMyAdmin.

You have to be more specific what you are trying to do?

You keep mention regarding NULL as Default.

Either you want NULL or Not NULL?

When you create a table and you add 2 or 3 column then you have an option to check NULL or Not NULL.

Read this if you don't understand what is a NULL or NOT NULL:

http://www.sqlservergeeks.com/articles/sql-server-bi/5/how-does-sql-server-treats-null-values

 
0
 

If you are willing to let people leave a box empty/field on the form, then you can do either default null or select the null checkbox!
Both will give the same result.

If you check the not null box, it will fail to store the empty / null value that the form passes it. And report an error.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article