我被问到是否有更好的方法来编写此查询,我认为没有。请帮忙:

 select bookid, bookname
   from books
  where bookname not like 'D%' or bookname not like 'F%'

最佳答案

SELECT bookid,
       bookname
FROM   books
WHERE  bookname IS NOT NULL


维护原始查询的语义。也许您打算使用AND而不是OR

SELECT bookid,
       bookname
FROM   books
WHERE  bookname NOT LIKE '[DF]%'

09-25 17:43