Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在oracle中违反外键_Sql_Oracle_Oracle10g_Sqlplus - Fatal编程技术网

Sql 如何在oracle中违反外键

Sql 如何在oracle中违反外键,sql,oracle,oracle10g,sqlplus,Sql,Oracle,Oracle10g,Sqlplus,大家好,我有以下关系: ALTER TABLE Role ADD CONSTRAINT ACTOR_ROLE_FK FOREIGN KEY (actorID) REFERENCES Actor (actorID); 我可以构造什么查询来测试它是否正常工作 谢谢我想从更新命令测试一下谢谢 请不要,这与我之前的问题不同,因为我问的是如何违反外键 感谢您的友好帮助尝试在角色中添加一行,该行的actorID在表Actor中不存在尝试在角色中添加一行,该行的actorID在表Actor中不存在 INSE

大家好,我有以下关系:

ALTER TABLE Role ADD CONSTRAINT ACTOR_ROLE_FK FOREIGN KEY (actorID) REFERENCES Actor (actorID);
我可以构造什么查询来测试它是否正常工作

谢谢我想从更新命令测试一下谢谢

请不要,这与我之前的问题不同,因为我问的是如何违反外键


感谢您的友好帮助

尝试在
角色
中添加一行,该行的
actorID
在表
Actor
中不存在

尝试在
角色
中添加一行,该行的
actorID
在表
Actor
中不存在

INSERT INTO Role (actorID) VALUE(X) 
-- replace X with a number that doesn't exist in the Actor table
Update Role
set actorID = '99'
where actorid = '00069'
这假定actor表的actorid='00069',而没有actorid='99'


这假设actor表有actorid='00069',没有actorid='99'

如果您想让我显示更多信息,请在将此标记为一个糟糕的负面问题之前通知我,因为我不知道您需要什么谢谢如果您想让我显示更多信息,请在标记之前通知我这是一个糟糕而消极的问题,因为我不知道你需要什么thanks@user1137472:当然,只需更新一个有效行,并将actorid列设置为Actor表中不存在的内容。update命令是否以update INTO或update Role set(actorid)值(X)开头@user1137472:Sure,只需更新一个有效行,并将actorid列设置为Actor表中不存在的内容。更新命令是否以update INTO或update Role set(actorid)VALUE(X)开头?我有以下内容:update Actor set lastName='Voight',birthDate='29-Dec-1938',其中actorid='00069';我将演员ID改为99,但它不存在,但仍在更新。你能给出一个syntaxI的例子吗?有以下内容:更新演员集lastName='Voight',生日='29-Dec-1938',其中ActorID='00069';我把演员ID改为99,但它不存在,它仍然在更新。你能举个语法的例子吗