Try the Introductory SQL Course for Free!

The SELECT Statement in SQL- Tutorial

/ / Access 2010, Access 2013, Latest, Microsoft, Office 2010, Office 2013, SQL

The SELECT Statement in SQL: Video Lesson

            This video lesson, titled “The SELECT Statement,” shows you the basic structure of the SELECT statement in SQL. This video lesson on the SELECT Statement in SQL is from our complete Introductory SQL training, titled “Mastering Introductory SQL Made Easy v.1.0.”

The SELECT Statement in SQL: Overview

            You use the SELECT statement in SQL to choose specific records to view from a table, or from related tables, within a temporary table called a result set. We will start the examination of the SELECT statement by looking at the SELECT statement in its simplest form when it is used to select all of the records from a single table. The core SQL of the statement is shown below. Note that the “table_name” parameter is the name of the table from which you want to select all the records and the “field_name” parameter is the name of a field within the table. Keywords within braces { } are optional.

SELECT { DISTINCT } field_name, field_name1, field_name2, etc.

FROM table_name

or

SELECT * FROM table_name

            In the first example shown above, the names of the fields of data you want to see within the result set are specified by name after writing the SELECT statement. You can write a SELECT statement in this manner to only show selected data fields from a table within the result set.

            The DISTINCT keyword, if used, will only display unique record values within the field_names that are specified. This is used when you do not want duplicate records to be returned within the result set. By default, all records will be returned within a result set unless the DISTINCT keyword is used.

            In the second example, the asterisk character is used to specify that ALL of the fields within the table should appear within the result set. The second statement will produce a result set that is, essentially, a temporary copy of all the records and fields within the table specified.

The SELECT Statement in SQL- Tutorial: A picture of the SELECT statement syntax in SQL.

The SELECT Statement in SQL- Tutorial: A picture of the SELECT statement syntax in SQL.

            Note that while the statement shown is the basis of the SELECT statement, the following lessons within this chapter will show how the SELECT statement is augmented with additional clauses and keywords to enhance its abilities. The SELECT statement is one of the most powerful and potentially complex statements within the SQL language. It is arguably the most important statement within SQL.

The SELECT Statement in SQL: Syntax Implementations

            The following hyperlinks display the full potential uses of the SELECT statement within MySQL 5.7, SQL Server 2012, and Access 2013. Note that the SELECT statement, as shown within these web pages, is actually quite complex.

MySQL 5.7:

http://dev.mysql.com/doc/refman/5.7/en/select.html

SQL Server 2012:

http://technet.microsoft.com/en-us/library/ms189499.aspx

Access 2013:

http://msdn.microsoft.com/en-us/library/office/ff821148.aspx

TOP