SQL SELECT – Selection of Columns From the Table – Basic Clause

Last modified date:

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]
FROM [Table];

or we use * symbol (asterisk) and request a complete list of columns (all):

SELECT *
FROM [Table];

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.

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: SQL Basics SQL Clauses Tags:

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.