I will not go deep in details.
I have Java program which is creating tables in Database. The thing is that when table is created one of the fields get default value. So when I am adding elements to this field I want to select default value. Now loading of all element's ID is:
SELECT distinct(codeKind) FROM [table_name];
I want to be something like this:
SELECT [default value of column codeKind] from [table_name];
I checked many of answer of other similiar questions but none of them is OK.
Thanks.
解决方案
use coalesce
select coalesce(codeKind,)
Alternatively you can set a fixed value for table's creation DDL such as
create table my_table ( my_column default 0, col2 int .... ) , if you leave the column value as blank in the insert statement, then the value is automatically populated as zero.