Developers

WHERE clause

PQL recognizes the WHERE clause the same way SQL does. Use the WHERE clause to restrict or filter your search. For example:

SELECT systemname||' '||name,size,freespace 
FROM /network/device/wmi/win32_logicaldisk 
WHERE drivetype = 3

This query searches for disk drive capacity and freespace on all systems, but is limited by only one type of drive.

Instances of a sub-tree — or records, if you're still thinking in tables — are selected using the WHERE clause, as with SQL. Once you've targeted a sub-tree in the FROM clause, the WHERE clause uses children of the target as attributes in the selection.

Depending on your database, this query finds results similar to this:

row
  systemname || || name KYOTO C:
  size 12889010176 Bytes
  freespace 2686287872 Bytes
row
  systemname || || name KYOTO D:
  size 237044310016 Bytes
  freespace 102629593088 Bytes
row
  systemname || || name CHIBA C:
  size 18161414144 Bytes
  freespace 796418048 Bytes
row
  systemname || || name CHIBA E:
  size 163921571840 Bytes
  freespace 106091302912 Bytes 
  ...

See path-scoped projection for an explanation of how to limit the query output. See path-scoped predicate for ways to write the WHERE clause with more elegance.


How do I find out more?