我想在下一个表格中对我的值设置一些特殊约束:
CREATE TABLE MyTable
{
id varchar(100) NOT NULL PRIMARY KEY,
first_special varchar(8), <- I want it to have max of 8 symbols with no spaces in it
second_special float <- I want it to have precision of 2 decimal points after the '.'
}
编辑:
该平台是Microsoft SQL Server。
答案 0 :(得分:1)
在Oracle中(我认为在所有dbs中)第二个很容易。
second_special NUMBER(5,2) -- The max number would be 999.99