Chapter 7. Using MariaDB – Retrieving Data

Data is useful only if we can retrieve or read it. In this chapter, we'll learn the basics of reading our data. We will cover the following topics:

  • Retrieving data
  • Filtering and searching data
  • Sorting data
  • Joining data
  • Summarizing data

Retrieving data

The command for retrieving or reading data from our database is called SELECT. Of all the SQL commands, this is the one which we will probably use most often. The syntax is rather complex, or can be, if we choose to use all the various options. However, the basic syntax is quite simple and is as follows:

SELECT <what> FROM <table_name>
    [WHERE <where-conditions>]
    [ORDER BY <column_name>];

In the <what> part, we specify the columns that we want to retrieve data ...

Get Getting Started with MariaDB - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.