O'Reilly logo

Getting Started with MariaDB - Second Edition by Daniel Bartholomew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filtering and searching data

In a table with lots of rows, we will probably want to restrict the number of rows that we retrieve. We can do this using one or more WHERE clauses. When filtering, we can use either full and exact column values or partial values.

Filtering by exact values

When filtering by exact values, we use the full value of a column. For example, a WHERE clause to retrieve data about everyone born on or after January 1, 1970 is given as follows:

WHERE birthday >= '1970-01-01'

The output will look similar to the following:

MariaDB [test]> SELECT * FROM employees 
    -> WHERE birthday >= '1970-01-01'; 
+----+----------------+---------------+-----------+------------+ 
| id | surname        | givenname     | pref_name | birthday   | 
+----+----------------+---------------+-----------+------------+ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required