, you presumably want to have some form of a
statement. Furthermore, your
pattern does not make sense as written. If I wrote:
The logic executed would be the following. Select a given string (
SELECT 'test' AS foo WHERE EXISTS(SELECT size from file WHERE path = '/tmp/et.txt');
), if a path matching:
'test' AS foo
exists in the
is not constrained in the
clause it has no bearing on the output of the query. Likewise it will never be _SELECT_ed because you are using an
condition which operates like a boolean. If you wanted to sub-select
for your '/tmp/et.txt' file you would need to modify your query. Using EXISTS here is duplicative and the same goal could be accomplished without it by doing the following:
--- I assume you are trying to do something else here but it is hard to guess based on the snippet alone. If you tell me the exact use-case you are trying to solve for, I would be more than happy to help you craft the SQL.
SELECT 'test' AS foo WHERE (SELECT 1 FROM file WHERE path = '/tmp/et.txt');
The query will only return rows if a file exists at that path.
SELECT size from file WHERE path = '/tmp/et.txt'
as it's rarely needed instead of a simple
on the other hand is often useful to me. For example, let's say I wanted to get all the
for a device that wasn't running the 'foobarbaz' process:
SELECT * FROM system_info WHERE NOT EXISTS (SELECT 1 FROM processes WHERE name = 'foobarbaz');
hostname = fritz-imac.lan uuid = E664D52B-5FBC-.... cpu_type = x86_64h cpu_subtype = Intel x86-64h Haswell cpu_brand = Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz cpu_physical_cores = 8 cpu_logical_cores = 16 cpu_microcode = physical_memory = 34359738368 hardware_vendor = Apple Inc. hardware_model = iMacPro1,1 hardware_version = 1.0 ...