Nov 03

This is usually the very first SQL command every SQL newbie learns and this is because the SELECT SQL statement is one of the most used SQL commands.

The SELECT statement is used to select data one or more database tables and/or views.

SELECT Column1, Column2, Column3 FROM table_name

Let’s have a look at the SELECT SQL statement above. The first part starts with the SELECT clause followed by a list of columns separated by commas. The list of column names after the SELECT SQL statement determines which columns you want to be returned in your result set. The second part of our SQL SELECT starts with the FROM clause followed by name of table from where we are extracting data.

If you want to select all columns from a database table, you can use the following the SQL statement:

SELECT * FROM table_name

When the list of columns following the SELECT SQL statement is replaced with asterix (*) all table columns are returned. Word of caution here, it’s always better to explicitly specify the columns in the SELECT list, as this will improve your query performance significantly.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Technorati
  • Twitter

Related Posts:

  1. SQL CREATE INDEX Statement
  2. The CREATE TABLE Statement
  3. The SQL SELECT INTO Statement
  4. The DELETE Statement
  5. SQL INSERT INTO Statement

Leave a Reply