Database Reference
In-Depth Information
SELECT DISTINCT column_name FROM
table_name;
SELECT DISTINCT column_name1,
column_name2 FROM table_name;
SELECT COUNT(DISTINCT column_name) FROM
table_name;
SELECT SUM(DISTINCT column_name) FROM
table_name;
SELECT SUM(DISTINCT column_name) FROM
table_name WHERE (column_name CONDITION
value);
LIKE : Sometimes performing wildcard-based comparisons with STRING data
is required, and for this requirement the LIKE operator is used. In Impala,
the LIKE operator is used as a comparison operator to match the STRING
type of data. For a single character match, LIKE uses _ (underscore) and for
multiple characters, the % (percentage) sign is used. Using the % wildcard at
the end of the string to get efficient results is suggested.
The following is the syntax of using the LIKE operator in Impala:
SELECT column_name FROM table_name WHERE
column_name LIKE '%';
SELECT column_name from table_name WHERE
column_name LIKE '_';
SELECT column_name from table_name WHERE
column_name LIKE '_' OR column_name LIKE
'%';
Now, let's see a few examples of using the LIKE operator in Impala. The fol-
lowing statement will return all the state names, which are only two charac-
ters and start with the letter C :
SELECT DISTINCT(state_names) from
us_state_list WHERE state_name LIKE 'C_';
Search WWH ::




Custom Search