SQL Functions Flashcards
(9 cards)
1
Q
Does BETWEEN include the min and max values in the range?
A
YES
1
Q
How IIF function works?
A
It works like a ternary
e.g.
IIF(carA > carB, “Car a is bigger”, “Car b is bigger”)
2
Q
Which function is used to get no duplicate records?
A
DISTINCT
e.g
SELECT DISTINCT previous_company
FROM employees;
3
Q
What is the difference between “%” and “_” operators?
A
- ”%” matches zero or more characters
- “_” matches a single character
4
Q
What is the default ORDER BY?
A
Ascending (ASC)
5
Q
What is an aggregation?
A
An “aggregation” is a single value that’s derived by combining several other values.
6
Q
When to use the “HAVING” clause?
A
When we need to filter the results of a GROUP BY query even further.
7
Q
What’s the difference between WHERE and HAVING?
A
- A WHERE condition is applied to all the data in a query before it’s grouped by a GROUP BY clause.
- A HAVING condition is only applied to the grouped rows that are returned after a GROUP BY is applied.
8
Q
A