Database Reference
In-Depth Information
Clauses
SQL statements require clauses to fulfill the statement condition or make it complete.
For example, the
SELECT
statement will not be able to fulfill its action unless we
provide what kind of
SELECT
action is actually needed. Most of these clauses are
used with
SELECT
; however, some of them may find other uses as well. Now, lets
learn the most common clauses in SQL, which are typically used in Impala. They are
as follows:
•
FROM
: The
SELECT
statement cannot be completed without the
FROM
clause.
The
FROM
clause specifies one or more tables containing the data that the
query retrieve from. The common syntax for the
FROM
clause along with a few
examples is as follows:
FROM [table_name,…]
WHERE…. [Condition];
Examples:
SELECT name, age, class, city, state,
country FROM studentslist;
SELECT name, age, class, city, state,
country FROM studentslist WHERE age < 18;
•
WHERE
: The next clause in our list is
WHERE
. The
WHERE
clause is used in
Impala to extract only those records that fulfill the defined criteria in SQL state-
ments.
WHERE
is very popular and is one of the most-used clauses along with
SELECT
and
FROM
. The syntax for the
WHERE
clause with an example is as
follows:
SELECT column_name,column_name FROM
table_name
WHERE column_name operator
value;
Example: