The asterisk sign (*) indicates that you want to select all fields contained in this table.

The MySQL FROM clause:

Let you specify from which table you want to retrieve all of these fields.

A table’s name always appears after the FROM keyword.

Selecting Specific Columns

the syntax for selecting specific columns in MySQL is:

SELECT column_name, column_name, column_name ..
FROM table_name

For example :

SELECT bookID , bookName
FROM books

The example above retrieves specific columns.

The MySQL SELECT clause:

Let you choose what columns you want to display.

After the MySQL SELECT keyword, specify the names of the columns that you would like to retrieve, separated by comma (,).

You can specify as many columns as you want; you can even specify the same column more than once.

The columns appear in the order selected.

The MySQL FROM clause:

Let you specify from which table you want to display these columns.

A table’s name always appears after the MySQL FROM keyword.

General Guidelines

In each SQL statement, MySQL SELECT and FROM clauses are mandatory. Without both of them, SQL statements are not valid (there is no point in seeking to display data without indicating what should be retrieved and from where).

It is possible to specify a column’s name multiple times; the data of this column will simply appear again and again, according to the number of times the column was specified.

SELECT bookID, bookName, bookPrice, bookPrice
FROM books

To enhance readability – even though the MySQL SQL syntax is neither case-sensitive, nor sensitive to spaces or line breaks, ensure writing in an orderly manner: write the keywords in capital letters, names of columns/tables in small letters, insert a line break after each command and indents when required.