Prev | Current Page 147 | Next

Marc Delisle

"Mastering phpMyAdmin 2.11 for Effective MySQL Management"

We only have to enter the word cinema and
use the operator LIKE %...% to perform that match. We should avoid using this form
of the LIKE operator on big tables (thousands of rows), because MySQL does not use
an index for data retrieval in this case, leading to wait time that could add up to half
an hour (or more). This is why this operator is not the default one in the drop-down
list, even though this method of searching is commonly used on smaller tables.
Searching Data
[ 156 ]
In versions prior to phpMyAdmin 2.6.0, we need to manually insert the % characters
to obtain '%cinema%', and use the LIKE operator from the drop-down list.
We also specify that the results be sorted (in ascending order) by title. In the
search interface, only one sorting field is possible. Here is a screenshot showing
how we ask for a search on cinema with the operator LIKE %...%:
The LIKE operator can be used for other types of wildcard searching, for
example History%??”which would search for this word at the beginning
of a title. This form of the LIKE query also has the benefit of using an
index, if MySQL finds one that speeds up data retrieval.
Using either of these methods of doing the query gives the following results:
Wildcard characters available are the % character (which matches any number of
characters) and the underscore (_) character (which matches a single character).


Pages:
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159