|
The asterisk "*" is used in conjunction with the
SELECT keyword to select all fields from a table or a query. The formula
to use is:
SELECT * FROM WhatObject;
Here is an example:
SELECT * FROM Employees;
|
The Asterisk * As a Wildcard
|
|
In a LIKE statement, an asterisk wildcard * can
be used to match any character, in any combination, for any length. Here
is an example
SELECT Employees.DateHired,
Employees.FirstName,
Employees.LastName,
Employees.Department
FROM Employees
WHERE Employees.LastName LIKE 'S*';
To negate the condition, you can precede the criterion
with the NOT operator just after WHERE. Here is an example:
SELECT Employees.DateHired,
Employees.FirstName,
Employees.LastName,
Employees.Department
FROM Employees
WHERE NOT (Employees.LastName Like 'S*');
In Microsoft Access, you can type the NOT
operator before the LIKE expression. Here is an example:
SELECT Employees.DateHired,
Employees.FirstName,
Employees.LastName,
Employees.Department
FROM Employees
WHERE (Employees.LastName) Not Like 'S*';
The Asterisk * In a Parameterized Query
|
|
You can use the asterisk as a placeholder when
creating a parameterized query.
Here is an example that uses the LIKE operator:
LIKE "*" & [A director name that includes] & "*"
Here is an example that uses the BETWEEN keyword:
BETWEEN [Enter a starting year] AND [Enter an ending year]