Search⌘ K
AI Features

SQL: Select Commands

Explore how to use SQL SELECT commands to retrieve data from tables by selecting specific fields, filtering records with WHERE clauses, ordering results, and limiting output for pagination. This lesson teaches key query techniques vital for managing data in PHP applications.

The most exciting SQL command is SELECT. It queries the data we saved. As with other commands, this lesson covers only the most common usages of the SELECT command. There’s much more in the documentation for relational database management systems.

Query everything

Here’s the query for all the data in the table:

MySQL
SELECT * FROM plays

Let’s look at each part of this query:

  • SELECT shows that it’s a query command.

  • * selects the fields we want to query. An asterisk here means we’re querying all the fields.

  • The FROM plays block shows which tables we want to query. Currently, it’s just one table, but it can be more. ... ...