SELECT clause is used to gain data from a table. This clause is followed by a list of columns, which we need to display.
SELECT must always be used in combination with clause FROM by which we state from which table we want the data to be selected. Ideally, we also add clause WHERE which helps us to limit the result based on some kind of a condition.
SQL SELECT Syntax
There are 2 basic options of how to get a list of fields from a table. The first option is to name the individual fields (columns) after the SELECT clause:
SELECT [Column 1], [Column 2]
or we use * symbol (asterisk) and request a complete list of columns (all):
It is needed to mention that the second option is not recommended since * has a negative effect on the performance of the query. We usually do not need to display all the columns. More displayed columns mean less performing queries (longer duration of the process).
Tip: Special form of use of this clause is combination with DISTINCT – displaying unique values.