What does “<>” mean in Oracle

前端 未结 10 2445
挽巷
挽巷 2020-12-30 19:46

What does <> mean in SQL language: Sample code is as follows

SELECT ordid,
       prodid,
       qty
FROM   item
WHERE  prodid IN (SELECT prodid
                  


        
10条回答
  •  萌比男神i
    2020-12-30 20:27

    It means not equal to, this is a good method to exclude certain elements from your query. For example lets say you have an orders tables and then you have OrderStatusID column within that table.

    You also have a status table where

    0 = OnHold, 
    1 = Processing, 
    2 = WaitingPayment, 
    3 = Shipped, 
    4 = Canceled.
    

    You can run a query where

    Select * From [Orders] where OrderStatusID <> 4
    

    this should give you all the orders except those that have been canceled! :D

提交回复
热议问题