Complex Queries Flashcards
(116 cards)
IN
Operator is used in a WHERE clause to determine if a value matches one of several values
BETWEEN
Operator provides an alternative way to determine if a value is between two other values.
Written as value BETWEEN minValue AND maxValue and is equivalent to valu
LIKE
Operator when used in a WHERE clause, matches text against a pattern using the two wildcard characters % and __.
BINARY
Like operator performs case-insensitive pattern matching by default or case-sensitive pattern matching if followed by the BINARY keyword
DISTINCT
used with a SELECT statement to return only unique or ‘distinct’ values
ORDER BY
Clause orders selected rows by one or more columns in ascending (alphabetic or increasing order)
DESC
When used with ORDER BY orders rows in descending order.
Function/Argument
Operates on an expression enclosed in parentheses, called an argument, and returns a value.
Aggregate function
processes values from a set of rows and returns a summary value
COUNT()
Counts the numbers of rows in the set
MIN()
Finds the minimum value in the set
MAX()
Finds the maximum value in the set
SUM()
sums all the values in the set
AVG
Computes the arithmetic mean of all the values in the set
GROUP BY
Each simple or composite value of the columns becomes a group. Query computes the aggregate function separately, and reutns one row, for each group
HAVING
used with the GROUP BY clause to filter group results
JOIN
JOIN is a SELECT statement that combines data from two tables, known as the left table and right table, into a single result
AS
Simplify queries or result tables, a column name can be replaced with an Alias. The alias follows the column name, separated by an optional AS keyword.
Join clause
Determines how a join query handles unmatched rows
INNER JOIN
selects only matching left and right table rows
FULL JOIN
selects all left and right table rows, regardless of match
On
Specifies the join columns.
LEFT JOIN
Selects all left table rows, but only matching right table rows
RIGHT JOIN
Selects all right table rows, but only matching left table rows