0

why is default a column ?

Why is default a column here when it did not allesr to be in the sql code

25th Sep 2017, 5:12 AM
Patrick Soulages
Patrick Soulages - avatar
2 Respuestas
+ 2
@Patrick Are you referring to the design view of a database table in something like phpMyAdmin? If so, the default property is used to specify the default value for a column during an insert command if no value is provided in the insert statement. Default values are useful for initializing values that can be deterministic based on expected use cases. For example, date created can automatically be determined by the database without the application explicitly specifying the current date time stamp. Many boolean / bit flags can be initialized as true or false without input from the application. For example, a column like [is_email_confirmed] would be initialized as false (or 0) because the email confirmation link could not be created, sent, and clicked on until after the corresponding database record was created. Once the confirmation link is created, the column [is_email_confirmed] would be explicitly updated to true (or 1). I'm only scratching the surface on this topic. The point is to show you how to approach using the default property for a database table column.
25th Sep 2017, 3:56 PM
David Carroll
David Carroll - avatar
0
@Patrick, I'm not sure I understand your question, what is it exactly do you mean "it did not allesr ...". If you see this in some script you can paste a piece of it here. (Edit) @Patrick, look, @David C gave a thorough answer related field to default value, I guess it is the answer to your question.
25th Sep 2017, 5:56 AM
Ipang