Section 3 Flashcards
The BETWEEN operator
Provides an alternative way to determine if a value is between two other values
The LIKE operator
When used in a WHERE clause, matches text against a pattern using the two wildcard characters % and _
% matches any number of characters. Ex: LIKE ‘L%t’ matches “Lt”, “Lot”, and “ Lol cat”.
_ matches exactly one character. Ex: LIKE ‘L_t’ matches “Lot”, and “Lit” but not “Lt” and “Loot”
The ORDER BY clause
Orders selected rows by one or more columns in ascending( alphabetic or increasing) order.
The DESC keyword with the ORDER BY clause orders rows in descending order.
Function: ABS(n)
Description: ?
Ex: ?
Description: Returns the absolute value of n
Ex: SELECT ABS(-5);
returns 5
Function: LOWER(s)
Description: ?
Ex: ?
Description: Returns the lowercase
Ex: SELECT LOWER(‘MySQL’);
returns ‘mysql’
Function: TRIM(s)
Description: ?
Ex: ?
Description: Returns the string s without leading and trailing spaces
Ex: SELECT TRIM(‘ test ‘);
returns ‘test’
Function:
HOUR(t)
MINUTE(t)
SECOND(t)
Description:?
Ex:?
Description: Returns the hour, minute or second from time t
An aggregate function
Processes values from a set of rows and returns a summary value.
Common aggregate functions are:
-COUNT() counts the number 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.
The HAVING clause
Is used with the GROUP BY clause to filter group results
A join is
A SELECT statement that combines data from two tables, known as the left table and right table, into a single result.
The tables are combined by comparing columns from the left and right tables, usually with the = operator
Inner join
Selects only only matching left and right table rows
Full join
Selects all left and right table rows, regardless of match
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.