在SQL语句中 有 SOME 和NOT EIXIT 么 具体什么意思 怎么用啊 各位大侠 多多举例 谢了
这个问题第1个回答:
查看了联机帮助便知,上面大量事例
这个问题第2个回答:
NOT EXISTS
查询在两表之间的差集,
就是在一表查询另一个表的不存在的记录 ..
这个问题第3个回答:
some,似乎没见过,可能是比较少见的用法。
这个问题第4个回答:
比较标量值和单列集中的值。SOME 和 ANY 是等效的。 以下示例创建一个存储过程,该过程确定是否能够在指定的天数中制造出 AdventureWorks 数据库中具有指定 SalesOrderID 的所有组件。该示例使用子查询为具有特定 SalesOrderID 的所有组件创建 DaysToManufacture 值的列表,然后测试子查询返回的值中是否有大于指定天数的值。如果返回的所有 DaysToManufacture 的值都小于规定的天数,则条件为 TRUE,并输出第一个消息。
SQL code
USE AdventureWorks ;
GO
CREATE PROCEDURE ManyDaysToComplete @OrderID int, @NumberOfDays int
AS
IF
@NumberOfDays < SOME
(
SELECT DaysToManufacture
FROM Sales.SalesOrderDetail
JOIN Production.Product
ON Sales.SalesOrderDetail.ProductID = Production.Product.ProductID
WHERE SalesOrderID = @OrderID
)
PRINT 'At least one item for this order cannot be manufactured in specified number of days.'
ELSE
PRINT 'All items for this order can be manufactured in the specified number of days or less.' ;
这个问题第5个回答:
some all any 分不开了
all 全部符合为真
any 至少一对符合为真
some 都符合,取反?
请教!