2016年2月22日 星期一

常用 SQL


  • SELECT LastName,FirstName,Address FROM Persons
    WHERE Address IS NOT NULL
SELECT * FROM Customers
WHERE City IN ('Paris','London'); 可以同時撈出來 符合 'Paris','London' 條件資料的 

  • SELECT * FROM Products
WHERE Price not BETWEEN 10 AND 20;

  • SELECT * FROM Products
WHERE Price BETWEEN 10 AND 20;
  • SELECT * FROM Products
WHERE (Price BETWEEN 10 AND 20)
    AND NOT CategoryID IN (1,2,3);

    沒有留言:

    張貼留言