Basic SELECT Statement
Basic SELECT Statement
Topic Introduction: In this tutorial, we will show SQL's very beginning structure. Here we will use a Structure Query and give a description of the clause & functions.
SQL Structure:
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table;
SELECT identifies the columns to be displayed.
FROM identifies the table containing those columns.
In its simplest form, a SELECT statement must include the following:
A SELECT clause, which specifies the columns to be displayed
A FROM clause, which identifies the table containing the columns that are listed in the SELECT
clause
In the syntax:
SELECT is a list of one or more columns.
* Select all columns.
DISTINCT Suppresses duplicates.
column|expression Selects the named column or the expression.
alias Gives the selected columns different headings.
FROM table Specifies the table containing the columns.
Note:
1. A keyword refers to an individual SQL element, for example, SELECT and FROM arekeywords.
2. A clause is a part of a SQL statement, for example, SELECT employee_id, last_name,and so on.
3. A statement is a combination of two or more clauses, for example, SELECT * FROMemployees.
No comments