SQL Functions Flashcards

1
Q

Does BETWEEN include the min and max values in the range?

A

YES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which function is used to get no duplicate records?

A

DISTINCT
e.g
SELECT DISTINCT previous_company
FROM employees;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between “%” and “_” operators?

A
  • ”%” matches zero or more characters
  • “_” matches a single character
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the default ORDER BY?

A

Ascending (ASC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an aggregation?

A

An “aggregation” is a single value that’s derived by combining several other values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When to use the “HAVING” clause?

A

When we need to filter the results of a GROUP BY query even further.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly