SELECT

Most of the SQL statements are one-word short and self-explanatory. This statement, for example, is used to select one or more columns from a specific table and to obtain the data from the said columns. Let's check out some of the sample commands that use the SELECT statement.

The following command retrieves all the data of all the columns from the user table:

SELECT * FROM user;

The following command retrieves only the username column from the user table:

SELECT username FROM user;

The following command retrieves the username and password columns from the user table with the condition that the id equals 1:

SELECT username, password FROM user WHERE id = 1;

You can try out these commands by yourself using phpMyAdmin. To do that, click ...

Get Hands-On GUI Programming with C++ and Qt5 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.