Access for 365 access 2021 accessibility 2019 access 2016 accessibility 2013 access 2010 access 2007 More...Less

The prefer criteria or operator is supplied in a query to discover data that matches a details pattern. Because that example, in ours database, we have actually a "Customers" table, favor the one below, and also we desire to locate only the customers life in urban whose names begin with "B". Here’s how we’ll create a query and also use the prefer criteria:

Open the client table:


On the Create tab, click Query Design.

Click Add and the client table gets included to the query designer.

You are watching: How many patients in the database have the last name of "smith"?

Double-click the Last Name and also City areas to add them come the query style grid.

In the City field, include the “Like B*” criteria, and click Run.


The ask results display only the client from urban names starting with the letter “B”.


To learn an ext about using criteria, see using criteria come a query.

peak of web page

Using the prefer operator in SQL syntax

If you choose doing this in SQL (Structured questions Language) syntax, this is how:

Open the customers table and on the Create tab, click Query Design.

On the Home tab, click View > SQL View and kind the complying with syntax:

select , City from Customers whereby City choose “B*”;

Click Run.

Right-click the ask tab, Save > Close.

For much more information see access SQL: an easy concepts, vocabulary, and syntax and learn an ext about how to edit SQL statements to sharpen ask results.

See more: Does Canned Crab Meat Need To Be Refrigerated ? Does Canned Crabmeat Need To Be Refrigerated

peak of page

Examples of prefer criteria patterns and also results

The Like criteria or operator comes in handy while to compare a field value to a wire expression. The following instance returns data that begins with the letter P adhered to by any kind of letter between A and also F and also three digits:

Like “P###” here are some means of making use of Like for different patterns:

kind of match


If your database has actually a matchyou’ll see

If her database doesn’t have a matchyou’ll see

Multiple characters


aa, aBa, aBBBa



abc, AABB, Xab

aZb, bac

Special character




Multiple characters


abcdefg, abc

cab, aab

Single character


aaa, a3a, aBa


Single digit


a0a, a1a, a2a

aaa, a10a

Range that characters

f, p, j

2, &

Outside a range

9, &, %

b, a

Not a digit

A, a, &, ~

0, 1, 9



An9, az0, a99

abc, aj0

Examples of favor criteria with wildcard characters

The complying with table shows types of results as soon as the choose criterion is supplied with a wildcard personalities in a table that can contain data with the particular matching patterns.



Like “E#”

Returns items with just two personalities where the an initial character is E and also the second is a number.