Today, we will see a very interesting puzzle about data types and default values.
There are three important properties for any column –
- Datatype
- Default value
- Null-ability
A column can be NULL or NOT NULL depending on the business requirements. Along with the null ability, often columns can have default values. Today we will see a puzzle where we will talk about data types and their default values.
Puzzle
Let us assume that there is a column with original datatype A and it has a default value of B. Due to some business reason, we changed the data type from original datatype A to new data type C. When the datatype got changed from A to C, even though we did not change the datatype, it was automatically changed from original default C to new default D. The value of default value D is completely different from the earlier default value of B.
You need to answer-
1 The original datatype A and default value B
2 The new datatype C and new default value D
I guess that’s it. If you think, the answer is very simple. Let us see if you can get it right or not.
Please post your answers in the comment sections. I will keep all the comments hidden till next week Thursday. This way everyone gets a chance to participate in this puzzle.
Reference:Â Pinal Dave (https://blog.sqlauthority.com)