我有一个 sql 查询“q”,其形式为:
Select attribute from table1, table2 where SC;
这里“SC”是q中所有选择谓词的合取
就我而言:SC is balance <1000 and salary >=50000
现在我想计算“NSC”,它是q中SC的否定,需要一些帮助。
最佳答案
根据您的帖子,您说i want to calculate "NSC" which is negation of SC
和
SC是balance <1000 and salary >=50000
因此,SC 的否定就是 balance >= 1000 and salary < 50000
所以,你可以这样做
Select attribute from table1 where balance >= 1000 and salary < 50000
(或)
Select attribute from table1
where attribute not in
( select attribute from table1
where balance <1000 and salary >=50000 )
关于mysql - 如何计算 SQL 查询的选择谓词的否定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24096265/