在DB表的每个字段上应用默认约束是否有任何缺点 [英] Is there any disadvantage of apply default constraints over every fields of DB table

查看:74
本文介绍了在DB表的每个字段上应用默认约束是否有任何缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有一个混乱,在DB表的每个字段都应用默认约束是否有任何缺点。



我想在表的每个字段都应用默认约束,所以每当我将任何数据保存到数据库表中时,应该保存一些默认值而不是null,

Hello,

I have a confusion, Is there any disadvantage of apply default constraints over every fields of DB table .

I want to apply default constraints at every fields of table, So whenever , I save any data into DB table, than it should be save with some default value rather than null,

推荐答案

DEFAULT约束用于在列中插入默认值。



如果没有指定其他值,默认值将被添加到所有新记录。



如果你在所有列中使用此约束意味着你无法插入空值。



除此之外不会有任何不利之处
The DEFAULT constraint is used to insert a default value into a column.

The default value will be added to all new records, if no other value is specified.

if u use this constraint across all columns means u can't able to insert the null values.

Other than this there will not be any disadvantages happen


这篇关于在DB表的每个字段上应用默认约束是否有任何缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆