Roland Deschain
Roland Deschain

Reputation: 2830

SQLite: Combining 'WHERE' conditions

A question for my general understanding: If I have:

SELECT X, Y, Z FROM MyTable

and I want only entries where none of the values are null I have to use

SELECT X, Y, Z FROM MyTable 
WHERE X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL

Is there a shorter option? Something like

SELECT X, Y, Z FROM MyTable 
WHERE X, Y, Z IS NOT NULL

This is just a short example, but I guess in queries with many conditions and requests something like this could make the query string much shorter and more readable.

Upvotes: 1

Views: 37

Answers (1)

Dumi
Dumi

Reputation: 1434

There is no such shorter form than below query.

SELECT X, Y, Z 
FROM MyTable 
WHERE X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL

Upvotes: 2

Related Questions