使用检查约束SQL向表中添加列 [英] Add a column to a table with check constraint SQL

查看:153
本文介绍了使用检查约束SQL向表中添加列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在表中添加一列,然后添加检查约束以确保其大于0.我似乎无法使其在oracle sl developer中运行.

I want to add a column to a table, then add a check constraint to make sure its greater than 0. I cant seem to get this to run in oracle sl developer.

Alter TABLE store101
add column Base_salary Number(7,2)
constraint store101_Base_salary_ck
check (Base_salary > 0);

错误报告- SQL错误:ORA-00904 ::无效的标识符 00904. 00000-%s:无效的标识符"

Error report - SQL Error: ORA-00904: : invalid identifier 00904. 00000 - "%s: invalid identifier"

推荐答案

这里是 SQLFiddle 演示

Here is SQLFiddle demo

这篇关于使用检查约束SQL向表中添加列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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