Find an Answer
Use boolean_expressions with operators such as <, >, =, and so on, to set limits, thresholds, or filters on query results. The possible elements of a boolean_expression include:
boolean_expression ::= ( boolean_expression )
boolean_expression ::= boolean_expression AND boolean_expression
boolean_expression ::= boolean_expression OR boolean_expression
boolean_expression ::= NOT boolean_expression
boolean_expression ::= expression = expression
boolean_expression ::= expression != expression | expression <> expression
boolean_expression ::= expression > expression
boolean_expression ::= expression < expression
boolean_expression ::= expression >= expression
boolean_expression ::= expression <= expression
boolean_expression ::= expression IS NULL
boolean_expression ::= expression IS NOT NULL
boolean_expression ::= expression LIKE STRING
boolean_expression ::= expression LIKE REGEX
boolean_expression ::= expression = REGEX
boolean_expression ::= REGEX = expression
boolean_expression ::= TRUE
boolean_expression ::= FALSE
The boolean_expression returns a Boolean value — that is, an either-or result such as True or False. Where the value of the boolean expression is unknown, null is returned.
PQL recognizes the standard SQL-type boolean values of true, false, or unknown, represented by null. Boolean expressions are often used in the WHERE clause with operators such as <, >, =, and so on, to set limits, thresholds, or filters on query results.
Query: What devices have free disk space that is less than 1 GB?
SELECT systemname, name, description, format(freespace, 'human_bytes') FROM %free disk space% WHERE freespace < 1000000000 AND description = 'Local Fixed Disk'
This query finds all machines with free disk space under 1 GB. The query uses a boolean expression in the WHERE freespace < 1000000000 clause to indicate a free space threshold.
Results: Depending on the database, this query returns results similar to this:
row
systemname LUXEMBURG
name C:
description Local Fixed Disk
format(freespace, human_bytes)
freespace 233.05 MB
row
systemname ROME
name D:
descriptionLocal Fixed Disk
format(freespace, human_bytes)
freespace 176.97 MB
row
systemname PARIS-VM-XP
name C:
description Local Fixed Disk
format(freespace, human_bytes)
freespace 318.95 MB
. . .
Query: How much disk space is used on devices of drive type 3?
SELECT systemname||' '||name, size, (size -freespace) as "Used Space" FROM /network/device/wmi/win32_logicaldisk WHERE drivetype = 3
his query creates a graph of local hard disk size and the used disk space on it, obtained via the Windows Management Instrumentation (WMI) tool. The query uses a boolean expression in the WHERE drivetype = 3 clause to limit the results to a single drive type.
Results: Depending on the database, this query returns results similar to this:
row systemname || || name SATURN D: size 500055896064 Bytes Used Space 216723492864 row systemname || || name JUPITER C: size 76100288512 Bytes Used Space 14057734144 row systemname || || name MERCURY C: size 12889010176 Bytes Used Space 9776181248 . . .
Query: List my drives and pertinent information about them.
SELECT systemname as "Machine Name", name as "Drive", description as "Label", drivetype as "Type", filesystem as "File System", volumeserialnumber as "Serial Number", format(size, 'human_bytes') as "Total Space", format(freespace, 'human_bytes') as "Free Space", format(size - freespace, 'human_bytes') as "Used Space", format((100 * freespace) / size, 'human_bytes')||'%' as "% Free" FROM /network/device/wmi/win32_logicaldisk WHERE description != 'Network Connection' order by 1,2
This query displays a list of disk and CD Rom drives obtained via the Windows Management Instrumentation (WMI) tool. The query uses a boolean expression in the WHERE description != 'Network Connection' clause to filter out drives described as network connections.
Results: Depending on the database, this query returns results similar to this:
row
Machine Name AS01-THMS232-ASB
Drive C:
Label Local Fixed Disk
Type 3 Local Disk
File System NTFS
Serial Number E433125D
Total Space
size 37.18 GB
Free Space
freespace 8.88 GB
Used Space 28.30 GB
% Free 23%
row
Machine Name AS01-THMS232-ASB
Drive D:
Label CD-ROM Disc
Type 5 Compact Disc
File System
Serial Number
Total Space
size
Free Space
freespace
Used Space null
% Free null
. . .
Related topics