WQL (SQL for WMI)

The WMI Query Language (WQL) is a subset of the American National Standards Institute Structured Query Language (ANSI SQL) with minor semantic changes. The following table lists the WQL keywords.

WQL keyword Meaning
AND
Combines two Boolean expressions, and returns TRUE when both expressions are TRUE.
[ASSOCIATORS OF](associators-of-statement.md) Retrieves all instances that are associated with a source instance.
Use this statement with schema queries and data queries.
[__CLASS](--class-identifier.md) References the class of the object in a query.
FROM
Specifies the class that contains the properties listed in a SELECT statement. Windows Management Instrumentation (WMI) supports data queries from only one class at a time.
[GROUP Clause](group-clause.md) Causes WMI to generate one notification to represent a group of events.
Use this clause with event queries.
[HAVING](having-clause.md) Filters the events that are received during the grouping interval that is specified in the [WITHIN clause](within-clause.md).
[IS](wql-operators.md) Comparison operator used with NOT and NULL. The syntax for this statement is the following:
IS [NOT] NULL
(where NOT is optional)
[ISA](wql-operators.md) Operator that applies a query to the subclasses of a specified class. For more information, see [ISA Operator for Event Queries](isa-operator-for-event-queries.md), [ISA Operator for Data Queries](isa-operator-for-data-queries.md), and [ISA Operator for Schema Queries](isa-operator-for-schema-queries.md).
KEYSONLY
Used in [REFERENCES OF](references-of-statement.md) and [ASSOCIATORS OF](associators-of-statement.md) queries to ensure that the resulting instances are only populated with the keys of the instances, which reduces the overhead of the call.
[LIKE](wql-operators.md) Operator that determines whether or not a given character string matches a specified pattern.
NOT
Comparison operator that use in a WQL SELECT query, for example:
SELECT * FROM meta_class WHERE NOT __class < "win32"="" and="" not="" __this="" isa="">
NULL Indicates an object does not have an explicitly assigned value. NULL is not equivalent to zero (0) or blank.
OR
Combines two conditions.
When more than one logical operator is used in a statement, the OR operators are evaluated after the AND operators.
[REFERENCES OF](references-of-statement.md) Retrieves all association instances that refer to a specific source instance. Use this statement with schema and data queries. The [REFERENCES OF](references-of-statement.md) statement is similar to the [ASSOCIATORS OF](associators-of-statement.md) statement. However, it does not retrieve endpoint instances; it retrieves the association instances.
SELECT
Specifies the properties that are used in a query.
For more information, see [SELECT Statement for Data Queries](select-statement-for-data-queries.md), [SELECT Statement for Event Queries](select-statement-for-event-queries.md), or [SELECT Statement for Schema Queries](select-statement-for-schema-queries.md).
TRUE Boolean operator that evaluates to -1 (minus one).
[WHERE](where-clause.md) Narrows the scope of a data, event, or schema query.
[WITHIN](within-clause.md) Specifies a polling or grouping interval.
Use this clause with event queries.
FALSE
Boolean operator that evaluates to 0 (zero).

Note

Using a WQL key word as an object name can result in a query that cannot be parsed even when the query compiles without error.

WQL Operators

WQL-Supported Date Formats

WQL-Supported Time Formats