mysql列默认值什么意思,选择列MySQL的默认值

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值